The patch titled Subject: mm/memory_hotplug: clean up try_offline_node has been added to the -mm tree. Its filename is mm-memory_hotplug-clean-up-try_offline_node.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-memory_hotplug-clean-up-try_offline_node.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-memory_hotplug-clean-up-try_offline_node.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Miaohe Lin <linmiaohe@xxxxxxxxxx> Subject: mm/memory_hotplug: clean up try_offline_node We can use helper macro node_spanned_pages to check whether node spans pages. And we can change the parameter of check_cpu_on_node to nid as that's what it really cares. Thus we can further get rid of the local variable pgdat and improve the readability a bit. Link: https://lkml.kernel.org/r/20220207133643.23427-4-linmiaohe@xxxxxxxxxx Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory_hotplug.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/mm/memory_hotplug.c~mm-memory_hotplug-clean-up-try_offline_node +++ a/mm/memory_hotplug.c @@ -2005,12 +2005,12 @@ static int get_nr_vmemmap_pages_cb(struc return mem->nr_vmemmap_pages; } -static int check_cpu_on_node(pg_data_t *pgdat) +static int check_cpu_on_node(int nid) { int cpu; for_each_present_cpu(cpu) { - if (cpu_to_node(cpu) == pgdat->node_id) + if (cpu_to_node(cpu) == nid) /* * the cpu on this node isn't removed, and we can't * offline this node. @@ -2044,7 +2044,6 @@ static int check_no_memblock_for_node_cb */ void try_offline_node(int nid) { - pg_data_t *pgdat = NODE_DATA(nid); int rc; /* @@ -2052,7 +2051,7 @@ void try_offline_node(int nid) * offline it. A node spans memory after move_pfn_range_to_zone(), * e.g., after the memory block was onlined. */ - if (pgdat->node_spanned_pages) + if (node_spanned_pages(nid)) return; /* @@ -2064,7 +2063,7 @@ void try_offline_node(int nid) if (rc) return; - if (check_cpu_on_node(pgdat)) + if (check_cpu_on_node(nid)) return; /* _ Patches currently in -mm which might be from linmiaohe@xxxxxxxxxx are mm-memremap-avoid-calling-kasan_remove_zero_shadow-for-device-private-memory.patch mm-sparse-make-mminit_validate_memmodel_limits-static.patch mm-vmalloc-remove-unneeded-function-forward-declaration.patch mm-mmzoneh-remove-unused-macros.patch mm-balloon_compaction-make-balloon-page-compaction-callbacks-static.patch mm-memory_hotplug-remove-obsolete-comment-of-__add_pages.patch mm-memory_hotplug-avoid-calling-zone_intersects-for-zone_normal.patch mm-memory_hotplug-clean-up-try_offline_node.patch mm-memory_hotplug-fix-misplaced-comment-in-offline_pages.patch mm-highmem-remove-unnecessary-done-label.patch mm-hmmc-remove-unneeded-local-variable-ret.patch