Skip to content

Commit 4792adb

Browse files
Jon Tollefsonozbenh
authored andcommitted
powerpc: Don't use a 16G page if beyond mem= limits
If mem= is used on the boot command line to limit memory then the memory block where a 16G page resides may not be available. Thanks to Michael Ellerman for finding the problem. Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent 71773f0 commit 4792adb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎arch/powerpc/mm/hash_utils_64.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,10 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
382382
printk(KERN_INFO "Huge page(16GB) memory: "
383383
"addr = 0x%lX size = 0x%lX pages = %d\n",
384384
phys_addr, block_size, expected_pages);
385-
lmb_reserve(phys_addr, block_size * expected_pages);
386-
add_gpage(phys_addr, block_size, expected_pages);
385+
if (phys_addr + (16 * GB) <= lmb_end_of_DRAM()) {
386+
lmb_reserve(phys_addr, block_size * expected_pages);
387+
add_gpage(phys_addr, block_size, expected_pages);
388+
}
387389
return 0;
388390
}
389391
#endif /* CONFIG_HUGETLB_PAGE */

0 commit comments

Comments
 (0)