With hugetlb_cma=, hugetlb_cma_reserve() reserves CMA areas for gigantic huge pages. If it ends up not reserving anything, it sets hugetlb_cma_size to 0, as it is the signal to the rest of hugetlb that the hugetlb CMA area exists. However, if the architecture does not support hugetlb CMA, hugetlb_cma_reserve() only warns and returns, but leaves hugetlb_cma_size as set by the command line. Consequently, we skip the boot-time allocation of gigantic huge pages, which matters on architectures where gigantic huge pages are allocated at boot, like powerpc with the hash MMU in an LPAR, where the firmware provides 16G pages. Further, we disable demotion of small huge pages and don't clear hugetlb_cma_only, so gigantic huge pages cannot be allocated at all. This only affects architectures with gigantic huge pages but without hugetlb CMA support, such as sparc64, sh, or powerpc with the hash MMU in an LPAR. The fix is trivial, so let's just reset hugetlb_cma_size like we do on the other paths that don't reserve anything. This has low urgency, as it requires passing hugetlb_cma= on one of these architectures. No need to CC stable. Fixes: dbda8feadfa4 ("mm/hugetlb: avoid hardcoding while checking if cma is enabled") Reported-by: Sashiko Signed-off-by: David Hildenbrand (Arm) --- mm/hugetlb_cma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/hugetlb_cma.c b/mm/hugetlb_cma.c index 3e5a30571524a..0a63197a9fc9c 100644 --- a/mm/hugetlb_cma.c +++ b/mm/hugetlb_cma.c @@ -249,6 +249,7 @@ void __init hugetlb_cma_reserve(void) order = arch_hugetlb_cma_order(); if (!order) { pr_warn("hugetlb_cma: the option isn't supported by current arch\n"); + hugetlb_cma_size = 0; return; } -- 2.56.1