Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5623947ybv; Tue, 18 Feb 2020 00:42:03 -0800 (PST) X-Google-Smtp-Source: APXvYqz+hSItrv8voYlmPzi4YdLu4djWpdIxGu9j2an6j76+YMMsmfJficdHrw59yz0f0+jAZ193 X-Received: by 2002:aca:2806:: with SMTP id 6mr521176oix.64.1582015323079; Tue, 18 Feb 2020 00:42:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582015323; cv=none; d=google.com; s=arc-20160816; b=s32nLWiNj+MQlEX/n5TuykEntRMgazgZNvDNPnGidNJA59/tQT0kOhyHw5niUTe7Ni vIZESKs2dCULCRZuts0cxwjCl21HiKzBFmMLtST3cWlfY+/fKcBqSfzQIhzH9cLpnoeF BgFePVkHkFWMuQlz68oS6wyr5JCVBzZM/tmLI4ZJnyY11wmNAFvjk5WXD10hfd1kHPFe sUppzZepvWhSr0759Tq3ufeX31Kc89/S6IzYDt3WgMW0vdOrtd6XqMaqeFgm6w89u1oV 8APazQQUgXX+nPmthcdT9PEVhWhvUO7WjRQs64W15Z7+bFqzLnzgK0kuwgRP3hX52Uuq 5fcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=y4L4vqax5DXxcdwoLUSziZL4YzCsONFZYcUjD/fBwIc=; b=GBLdgRxHmMNB+7uooTswddQJhfRZO7cTUWJ9sePAUcDxfPV4IuPyc3sqkbYGi6p2Up cDK2zHyjtif2ezM8LFINf5EklNCATCtt0oq8dztTxOlhYmkDp2h4b+e978sV3mjhm1hq vvq/eNj5rhVqVUCKYlCkkJ4eveSM59K+65iAa9sfu4xyRHVwvTSfp5XsccfvK0gRyJyH mVYl/ZMgdo3/i78T2VXbYxM0hwiaq1Cqyc3ur/TQQauO0jyW+QG9otDUcYmSD45rycFg Taq2PSuALytRGD19q9SJ96lNORSil3YzwV7ofB2jf431v5M3M26tbD2VRym2mkCHK10C WreA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u14si1486471otg.10.2020.02.18.00.41.50; Tue, 18 Feb 2020 00:42:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726333AbgBRIk2 (ORCPT + 99 others); Tue, 18 Feb 2020 03:40:28 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:51286 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726303AbgBRIk1 (ORCPT ); Tue, 18 Feb 2020 03:40:27 -0500 Received: by mail-wm1-f67.google.com with SMTP id t23so1850958wmi.1 for ; Tue, 18 Feb 2020 00:40:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=y4L4vqax5DXxcdwoLUSziZL4YzCsONFZYcUjD/fBwIc=; b=GywDSw5WcriIpyIhsk5RX2Y3WMpz3BSTWeiSfqe5BxZ5If9cG9fUrON96LxNQdI3hG 5LjYZPVrrdBfGqfXG2DPX9gRz/mbvpHkZ2wUhzsbQOqGaMlB8RGm8dPduQ+5pAaATM1S L5LkWSU+2OtrULoyXSCZrXKWZobnWJYVl7yvjSJF8INyp0bO3vxBtWNbKRFnLBaU/U2h 38hYEsa+Qr4hpsR3H9f76AMl/dUsAYQwpBElKJz9HHSAUOo9q2IOiPEMKgvE6OZyEwxg uHxztHCBILueHJ6q2aZjYfxtycr3C36FFHnW1gGaUdPs+tLjS2UrYUwPNkS7f4mtJRR/ PiOA== X-Gm-Message-State: APjAAAXRK8e2dcjpqhjHNXMjfR0CY2oBCsPUK6QDyWHa0fW0mFgmscYZ zWzWoHZ6SapQX0I010UH0WU= X-Received: by 2002:a7b:cc81:: with SMTP id p1mr1782467wma.62.1582015224739; Tue, 18 Feb 2020 00:40:24 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id r1sm5026822wrx.11.2020.02.18.00.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 00:40:23 -0800 (PST) Date: Tue, 18 Feb 2020 09:40:23 +0100 From: Michal Hocko To: Wei Yang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, rientjes@google.com Subject: Re: [PATCH] mm/vmscan.c: remove cpu online notification for now Message-ID: <20200218084023.GC21113@dhcp22.suse.cz> References: <20200218004354.24996-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200218004354.24996-1-richardw.yang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 18-02-20 08:43:54, Wei Yang wrote: > The cpu online notification is used to adjust kswapd cpu affinity when a > NUMA node gains a new CPU. > > Since currently we don't see a real runtime configuration like this, > let's drop this online notification for now. This deserves much more explanation IMHO. What would you say about the following. " kswapd kernel thread starts either with a CPU affinity set to the full cpu mask of its target node or without any affinity at all if the node is CPUless. There is a cpu hotplug callback (kswapd_cpu_online) that implements an elaborate way to update this mask when a cpu is onlined. It is not really clear whether there is any actual benefit from this scheme. Completely CPU-less NUMA nodes rarely gain a new CPU during runtime. Drop the code for that reason. If there is a real usecase then we can resurrect and simplify the code. " > > Suggested-by: Michal Hocko > Signed-off-by: Wei Yang Acked-by: Michal Hocko > > --- > v3: > * remove the cpu online notification suggested by Michal > v2: > * rephrase the changelog > --- > mm/vmscan.c | 27 +-------------------------- > 1 file changed, 1 insertion(+), 26 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 665f33258cd7..a4fdf3dc8887 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -4023,27 +4023,6 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim) > } > #endif /* CONFIG_HIBERNATION */ > > -/* It's optimal to keep kswapds on the same CPUs as their memory, but > - not required for correctness. So if the last cpu in a node goes > - away, we get changed to run anywhere: as the first one comes back, > - restore their cpu bindings. */ > -static int kswapd_cpu_online(unsigned int cpu) > -{ > - int nid; > - > - for_each_node_state(nid, N_MEMORY) { > - pg_data_t *pgdat = NODE_DATA(nid); > - const struct cpumask *mask; > - > - mask = cpumask_of_node(pgdat->node_id); > - > - if (cpumask_any_and(cpu_online_mask, mask) < nr_cpu_ids) > - /* One of our CPUs online: restore mask */ > - set_cpus_allowed_ptr(pgdat->kswapd, mask); > - } > - return 0; > -} > - > /* > * This kswapd start function will be called by init and node-hot-add. > * On node-hot-add, kswapd will moved to proper cpus if cpus are hot-added. > @@ -4083,15 +4062,11 @@ void kswapd_stop(int nid) > > static int __init kswapd_init(void) > { > - int nid, ret; > + int nid; > > swap_setup(); > for_each_node_state(nid, N_MEMORY) > kswapd_run(nid); > - ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, > - "mm/vmscan:online", kswapd_cpu_online, > - NULL); > - WARN_ON(ret < 0); > return 0; > } > > -- > 2.17.1 -- Michal Hocko SUSE Labs