Skip to content

Commit 618e078

Browse files
Barry Songwilldeacon
authored andcommitted
arm64: mm: reserve hugetlb CMA after numa_init
hugetlb_cma_reserve() is called at the wrong place. numa_init has not been done yet. so all reserved memory will be located at node0. Fixes: cf11e85 ("mm: hugetlb: optionally allocate gigantic hugepages using cma") Signed-off-by: Barry Song <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Acked-by: Roman Gushchin <[email protected]> Cc: Matthias Brugger <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent b9249cb commit 618e078

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

arch/arm64/mm/init.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,6 @@ void __init arm64_memblock_init(void)
404404
high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
405405

406406
dma_contiguous_reserve(arm64_dma32_phys_limit);
407-
408-
#ifdef CONFIG_ARM64_4K_PAGES
409-
hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT);
410-
#endif
411-
412407
}
413408

414409
void __init bootmem_init(void)
@@ -424,6 +419,16 @@ void __init bootmem_init(void)
424419
min_low_pfn = min;
425420

426421
arm64_numa_init();
422+
423+
/*
424+
* must be done after arm64_numa_init() which calls numa_init() to
425+
* initialize node_online_map that gets used in hugetlb_cma_reserve()
426+
* while allocating required CMA size across online nodes.
427+
*/
428+
#ifdef CONFIG_ARM64_4K_PAGES
429+
hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT);
430+
#endif
431+
427432
/*
428433
* Sparsemem tries to allocate bootmem in memory_present(), so must be
429434
* done after the fixed reservations.

0 commit comments

Comments
 (0)