mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
mm/sparse: initialize memory sections earlier
Upcoming HugeTLB bootmem changes need sparsemem section metadata before the HugeTLB bootmem allocation path runs. The memory sections are initialized from sparse_init(), which is called too late for that setup. Move the code that initializes sparsemem section metadata for memblock ranges into mm_core_init_early(), before free_area_init() and the HugeTLB bootmem setup. Rename the helper to sparse_sections_init() so the new caller describes the sparsemem-specific initialization step. This is a preparatory change. Link: https://lore.kernel.org/20260910063256.64386-10-songmuchun@bytedance.com Signed-off-by: Muchun Song <songmuchun@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Acked-by: Qi Zheng <qi.zheng@linux.dev> Cc: David Hildenbrand (Arm) <david@kernel.org> Cc: David Laight <david.laight.linux@gmail.com> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Oscar Salvador <osalvador@suse.de> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org>
This commit is contained in:
parent
a64b8c60c6
commit
74d2a4e89f
|
|
@ -2642,6 +2642,7 @@ void __init mm_core_init_early(void)
|
|||
{
|
||||
kho_memory_init_early();
|
||||
|
||||
sparse_sections_init();
|
||||
free_area_init();
|
||||
|
||||
hugetlb_cma_reserve();
|
||||
|
|
|
|||
|
|
@ -191,12 +191,7 @@ static void __init memory_present(int nid, unsigned long start, unsigned long en
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark all memblocks as present using memory_present().
|
||||
* This is a convenience function that is useful to mark all of the systems
|
||||
* memory as present during initialization.
|
||||
*/
|
||||
static void __init memblocks_present(void)
|
||||
void __init sparse_sections_init(void)
|
||||
{
|
||||
unsigned long start, end;
|
||||
int i, nid;
|
||||
|
|
@ -322,8 +317,6 @@ void __init sparse_init(void)
|
|||
unsigned long pnum_end, pnum_begin, map_count = 1;
|
||||
int nid_begin;
|
||||
|
||||
memblocks_present();
|
||||
|
||||
if (compound_info_has_mask()) {
|
||||
VM_WARN_ON_ONCE(!IS_ALIGNED((unsigned long) pfn_to_page(0),
|
||||
MAX_FOLIO_VMEMMAP_ALIGN));
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ static inline bool vmemmap_optimizable_order(unsigned int order)
|
|||
*/
|
||||
#ifdef CONFIG_SPARSEMEM
|
||||
void sparse_init(void);
|
||||
void sparse_sections_init(void);
|
||||
int sparse_index_init(unsigned long section_nr, int nid);
|
||||
|
||||
static inline void sparse_init_one_section(struct mem_section *ms,
|
||||
|
|
@ -104,6 +105,7 @@ static inline bool section_vmemmap_optimizable(const struct mem_section *ms)
|
|||
}
|
||||
#else
|
||||
static inline void sparse_init(void) {}
|
||||
static inline void sparse_sections_init(void) {}
|
||||
#endif /* CONFIG_SPARSEMEM */
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user