Re: [PATCH 11/14] mm/sparse: drop set_section_nid() from sparse_add_section()

From: Mike Rapoport

Date: Wed Mar 18 2026 - 04:50:50 EST


On Tue, Mar 17, 2026 at 05:56:49PM +0100, David Hildenbrand (Arm) wrote:
> CONFIG_MEMORY_HOTPLUG is CONFIG_SPARSEMEM_VMEMMAP-only. And
> CONFIG_SPARSEMEM_VMEMMAP implies that NODE_NOT_IN_PAGE_FLAGS cannot be set:

Maybe

... implies that node is always in page flags and NODE_NOT_IN_PAGE_FLAGS
cannot be set

> see include/linux/page-flags-layout.h
>
> ...
> #elif defined(CONFIG_SPARSEMEM_VMEMMAP)
> #error "Vmemmap: No space for nodes field in page flags"
> ...
>
> So let's remove the set_section_nid() call to prepare for moving
> CONFIG_MEMORY_HOTPLUG to mm/sparse-vmemmap.c
>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

Reviewed-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>

> ---
> mm/sparse.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 7b0bfea73a9b..b5a2de43ac40 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -769,7 +769,6 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn,
> page_init_poison(memmap, sizeof(struct page) * nr_pages);
>
> ms = __nr_to_section(section_nr);
> - set_section_nid(section_nr, nid);
> __section_mark_present(ms, section_nr);
>
> /* Align memmap to section boundary in the subsection case */
> --
> 2.43.0
>

--
Sincerely yours,
Mike.