From: Qi Zheng A 32-bit x86 kernel can run on a 64-bit-capable CPU advertising GBPAGES. arch_hugetlb_cma_order() checks only this feature and returns a nonzero order, although gigantic HugeTLB support on x86 requires CONFIG_X86_64. Specifying hugetlb_cma= can therefore reserve a CMA area that cannot serve the intended gigantic HugeTLB allocations. On non-PAE kernels, the folded PUD_SHIFT yields a 4 MiB order, which is equal to MAX_PAGE_ORDER. With CONFIG_DEBUG_VM enabled, this triggers the VM_WARN_ON(order <= MAX_PAGE_ORDER) check in hugetlb_cma_reserve(), warning that hugetlb_cma is attempting to reserve a non-gigantic order. Require CONFIG_X86_64 as well as GBPAGES when selecting the default CMA order to avoid these ineffective reservations. Fixes: cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic hugepages using cma") Cc: stable@vger.kernel.org Signed-off-by: Qi Zheng Acked-by: Muchun Song Reviewed-by: Jose A. Perez de Azpillaga Acked-by: Oscar Salvador --- arch/x86/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c index 3b26621c91286..70726a99ede7b 100644 --- a/arch/x86/mm/hugetlbpage.c +++ b/arch/x86/mm/hugetlbpage.c @@ -45,7 +45,7 @@ arch_initcall(gigantic_pages_init); unsigned int __init arch_hugetlb_cma_order(void) { - if (boot_cpu_has(X86_FEATURE_GBPAGES)) + if (IS_ENABLED(CONFIG_X86_64) && boot_cpu_has(X86_FEATURE_GBPAGES)) return PUD_SHIFT - PAGE_SHIFT; return 0; -- 2.54.0