* [Patch v4] mm/vmscan.c: remove cpu online notification for now
@ 2020-02-18 22:44 Wei Yang
2020-02-19 20:08 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Wei Yang @ 2020-02-18 22:44 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, rientjes, mhocko, Wei Yang
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.
[mhocko@suse.com rewrite changelog]
Suggested-by: Michal Hocko <mhocko@suse.org>
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
---
v4:
* adjust changelog suggested by Michal
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Patch v4] mm/vmscan.c: remove cpu online notification for now
2020-02-18 22:44 [Patch v4] mm/vmscan.c: remove cpu online notification for now Wei Yang
@ 2020-02-19 20:08 ` Andrew Morton
2020-02-20 7:52 ` Michal Hocko
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2020-02-19 20:08 UTC (permalink / raw)
To: Wei Yang; +Cc: linux-mm, linux-kernel, rientjes, mhocko
On Wed, 19 Feb 2020 06:44:22 +0800 Wei Yang <richardw.yang@linux.intel.com> wrote:
> 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.
This is the case across all platforms, all architectures, all users for
the next N years? I'm surprised that we know this with sufficient
confidence. Can you explain how you came to make this assertion?
> Drop the code for that reason. If there is a real usecase then
> we can resurrect and simplify the code.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch v4] mm/vmscan.c: remove cpu online notification for now
2020-02-19 20:08 ` Andrew Morton
@ 2020-02-20 7:52 ` Michal Hocko
2020-02-20 17:03 ` Yang Shi
0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2020-02-20 7:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: Wei Yang, linux-mm, linux-kernel, rientjes
On Wed 19-02-20 12:08:10, Andrew Morton wrote:
> On Wed, 19 Feb 2020 06:44:22 +0800 Wei Yang <richardw.yang@linux.intel.com> wrote:
>
> > 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.
>
> This is the case across all platforms, all architectures, all users for
> the next N years? I'm surprised that we know this with sufficient
> confidence. Can you explain how you came to make this assertion?
CPUless NUMA nodes are quite rare - mostly ppc with crippled LPARs.
I am not aware those would dynamically get CPUs for those nodes later in
the runtime. Maybe they do but we would like to learn about that. A
missing cpu mask is not going cause any fatal problems anyway.
As the changelog states the callback can be reintroduced with a sign of
testing and usecase description. I prefer we drop this code in the mean
time as the benefit is not really clear or testable.
> > Drop the code for that reason. If there is a real usecase then
> > we can resurrect and simplify the code.
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch v4] mm/vmscan.c: remove cpu online notification for now
2020-02-20 7:52 ` Michal Hocko
@ 2020-02-20 17:03 ` Yang Shi
0 siblings, 0 replies; 4+ messages in thread
From: Yang Shi @ 2020-02-20 17:03 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Wei Yang, Linux MM, Linux Kernel Mailing List,
David Rientjes
On Wed, Feb 19, 2020 at 11:52 PM Michal Hocko <mhocko@kernel.org> wrote:
>
> On Wed 19-02-20 12:08:10, Andrew Morton wrote:
> > On Wed, 19 Feb 2020 06:44:22 +0800 Wei Yang <richardw.yang@linux.intel.com> wrote:
> >
> > > 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.
> >
> > This is the case across all platforms, all architectures, all users for
> > the next N years? I'm surprised that we know this with sufficient
> > confidence. Can you explain how you came to make this assertion?
>
> CPUless NUMA nodes are quite rare - mostly ppc with crippled LPARs.
> I am not aware those would dynamically get CPUs for those nodes later in
> the runtime. Maybe they do but we would like to learn about that. A
> missing cpu mask is not going cause any fatal problems anyway.
Persistent memory nodes are CPUless nodes. But, I don't think they
would get any CPU online later in the runtime.
>
> As the changelog states the callback can be reintroduced with a sign of
> testing and usecase description. I prefer we drop this code in the mean
> time as the benefit is not really clear or testable.
>
> > > Drop the code for that reason. If there is a real usecase then
> > > we can resurrect and simplify the code.
>
> --
> Michal Hocko
> SUSE Labs
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-20 17:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18 22:44 [Patch v4] mm/vmscan.c: remove cpu online notification for now Wei Yang
2020-02-19 20:08 ` Andrew Morton
2020-02-20 7:52 ` Michal Hocko
2020-02-20 17:03 ` Yang Shi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).