Re: [PATCH 11/14] mm/sparse: drop set_section_nid() from sparse_add_section()
From: Lorenzo Stoakes (Oracle)
Date: Tue Mar 17 2026 - 15:56:20 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:
> 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
>
Maybe worth mentioning:
#ifdef NODE_NOT_IN_PAGE_FLAGS
...
static void set_section_nid(unsigned long section_nr, int nid)
{
... actually does something ...
}
#else /* !NODE_NOT_IN_PAGE_FLAGS */
static inline void set_section_nid(unsigned long section_nr, int nid)
{
}
#endif
Or more succintly 'set_section_nid() is a nop' or something :P
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
You may have dropped the call, but you've not dropped the ball, so:
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@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
>