Message ID | 32c12381941f347ebafb9cb5bc9f0a4a535ff646.1697687357.git.zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | handle memoryless nodes more appropriately | expand |
On 19.10.23 09:36, Qi Zheng wrote: > In offline_pages(), if a node becomes memoryless, we > will clear its N_MEMORY state by calling node_states_clear_node(). > But we do this after rebuilding the zonelists by calling > build_all_zonelists(), which will cause this memoryless node to > still be in the fallback list of other nodes. This will incur > some runtime overhead. > > To drop memoryless node from fallback lists in this case, just > call node_states_clear_node() before calling build_all_zonelists(). > > Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> > --- > mm/memory_hotplug.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index d4a364fdaf8f..18af399627f0 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -2036,12 +2036,12 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages, > /* reinitialise watermarks and update pcp limits */ > init_per_zone_wmark_min(); > > + node_states_clear_node(node, &arg); > if (!populated_zone(zone)) { > zone_pcp_reset(zone); > build_all_zonelists(NULL); > } > > - node_states_clear_node(node, &arg); > if (arg.status_change_nid >= 0) { > kcompactd_stop(node); > kswapd_stop(node); Probably worth a comment. /* * Make sure to mark the node as memory-less before rebuilding the zone * list. Otherwise this node would still appear in the fallback lists. */ Acked-by: David Hildenbrand <david@redhat.com>
Hi David, On 2023/10/19 16:11, David Hildenbrand wrote: > On 19.10.23 09:36, Qi Zheng wrote: >> In offline_pages(), if a node becomes memoryless, we >> will clear its N_MEMORY state by calling node_states_clear_node(). >> But we do this after rebuilding the zonelists by calling >> build_all_zonelists(), which will cause this memoryless node to >> still be in the fallback list of other nodes. This will incur >> some runtime overhead. >> >> To drop memoryless node from fallback lists in this case, just >> call node_states_clear_node() before calling build_all_zonelists(). >> >> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> >> --- >> mm/memory_hotplug.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c >> index d4a364fdaf8f..18af399627f0 100644 >> --- a/mm/memory_hotplug.c >> +++ b/mm/memory_hotplug.c >> @@ -2036,12 +2036,12 @@ int __ref offline_pages(unsigned long >> start_pfn, unsigned long nr_pages, >> /* reinitialise watermarks and update pcp limits */ >> init_per_zone_wmark_min(); >> + node_states_clear_node(node, &arg); >> if (!populated_zone(zone)) { >> zone_pcp_reset(zone); >> build_all_zonelists(NULL); >> } >> - node_states_clear_node(node, &arg); >> if (arg.status_change_nid >= 0) { >> kcompactd_stop(node); >> kswapd_stop(node); > > Probably worth a comment. > > /* > * Make sure to mark the node as memory-less before rebuilding the zone > * list. Otherwise this node would still appear in the fallback lists. > */ OK, will add it in the v3. > > Acked-by: David Hildenbrand <david@redhat.com> Thanks. >
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index d4a364fdaf8f..18af399627f0 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -2036,12 +2036,12 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages, /* reinitialise watermarks and update pcp limits */ init_per_zone_wmark_min(); + node_states_clear_node(node, &arg); if (!populated_zone(zone)) { zone_pcp_reset(zone); build_all_zonelists(NULL); } - node_states_clear_node(node, &arg); if (arg.status_change_nid >= 0) { kcompactd_stop(node); kswapd_stop(node);
In offline_pages(), if a node becomes memoryless, we will clear its N_MEMORY state by calling node_states_clear_node(). But we do this after rebuilding the zonelists by calling build_all_zonelists(), which will cause this memoryless node to still be in the fallback list of other nodes. This will incur some runtime overhead. To drop memoryless node from fallback lists in this case, just call node_states_clear_node() before calling build_all_zonelists(). Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)