Re: [PATCH v2 08/69] mm/mm_init: Defer sparse_init() until after zone initialization

From: Oscar Salvador (SUSE)

Date: Mon May 18 2026 - 02:29:44 EST


On Wed, May 13, 2026 at 09:04:36PM +0800, Muchun Song wrote:
> void __init mm_core_init_early(void)
> {
> + int nid;
> +
> hugetlb_cma_reserve();
> hugetlb_bootmem_alloc();
>
> free_area_init();
> +
> + sparse_init();
> + for_each_node_state(nid, N_MEMORY)
> + sparse_vmemmap_init_nid_late(nid);

Would it not make more sense to hide sparse_vmemmap_init_nid_late()
within sparse_init() and have it called at the end of the function?

The flow would be:

sparse_init()
sparse_init_nid
sparse_vmemmap_init_nid_early
...
sparse_vmemmap_init_nid_late

I think it is better to have sparse stuff all together in one place instead of scattered.



--
Oscar Salvador
SUSE Labs