[merged mm-stable] mm-mm_init-defer-sparse_init-until-after-zone-initialization.patch removed from -mm tree
Andrew Morton <[email protected]> Tue, 28 Jul 2026 21:14:22 -0700
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The quilt patch titled
Subject: mm/mm_init: defer sparse_init() until after zone initialization
has been removed from the -mm tree. Its filename was
mm-mm_init-defer-sparse_init-until-after-zone-initialization.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Muchun Song <[email protected]>
Subject: mm/mm_init: defer sparse_init() until after zone initialization
Date: Fri, 12 Jun 2026 11:58:52 +0800
free_area_init() is responsible for initializing pgdat and zone state.
Calling sparse_init() from there mixes in later vmemmap and struct page
setup, which makes the initialization flow less clear.
Defer sparse_init(), sparse_vmemmap_init_nid_late(), and memmap_init()
until after free_area_init() completes, when zone initialization is fully
done. This keeps free_area_init() focused on zone setup and ensures that
sparse_init() runs with the relevant zone state already available.
This is also a prerequisite for later hugetlb vmemmap changes that need
zone information during early sparse vmemmap setup.
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Muchun Song <[email protected]>
Reviewed-by: Mike Rapoport (Microsoft) <[email protected]>
Reviewed-by: Oscar Salvador (SUSE) <[email protected]>
Cc: "Aneesh Kumar K.V" <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Frank van der Linden <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Cc: Madhavan Srinivasan <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: "Ritesh Harjani (IBM)" <[email protected]>
Cc: Usama Arif <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
mm/mm_init.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
--- a/mm/mm_init.c~mm-mm_init-defer-sparse_init-until-after-zone-initialization
+++ a/mm/mm_init.c
@@ -1821,7 +1821,6 @@ static void __init free_area_init(void)
bool descending;
arch_zone_limits_init(max_zone_pfn);
- sparse_init();
start_pfn = PHYS_PFN(memblock_start_of_DRAM());
descending = arch_has_descending_max_zone_pfns();
@@ -1910,11 +1909,7 @@ static void __init free_area_init(void)
}
}
- for_each_node_state(nid, N_MEMORY)
- sparse_vmemmap_init_nid_late(nid);
-
calc_nr_kernel_pages();
- memmap_init();
/* disable hash distribution for systems with a single node */
fixup_hashdist();
@@ -2686,10 +2681,17 @@ void __init __weak mem_init(void)
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);
+ memmap_init();
}
/*
_
Patches currently in -mm which might be from [email protected] are
selftests-mm-remove-obsolete-hugetlb-vmemmap-test.patch