Hi all,

After merging the akpm-current tree, today's linux-next build
(sparc64 defconfig) failed like this:

mm/hugetlb.c: In function 'free_gigantic_page':
mm/hugetlb.c:1233:18: error: 'hugetlb_cma' undeclared (first use in this 
function); did you mean 'hugetlb_lock'?
      cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order))
                  ^~~~~~~~~~~
                  hugetlb_lock

Caused by commits

  ee0889218f26 ("mm/hugetlb: avoid hardcoding while checking if cma is enabled")
  8729fda59982 
("mm-hugetlb-avoid-hardcoding-while-checking-if-cma-is-enabled-fix")

I have added this patch for today:

From: Stephen Rothwell <s...@canb.auug.org.au>
Date: Tue, 21 Jul 2020 20:44:57 +1000
Subject: [PATCH] mm/hugetlb: better checks before using hugetlb_cma

Signed-off-by: Stephen Rothwell <s...@canb.auug.org.au>
---
 mm/hugetlb.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 4b560c7555e7..4645f1441d32 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1229,9 +1229,10 @@ static void free_gigantic_page(struct page *page, 
unsigned int order)
         * If the page isn't allocated using the cma allocator,
         * cma_release() returns false.
         */
-       if (IS_ENABLED(CONFIG_CMA) &&
-           cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order))
+#ifdef CONFIG_CMA
+       if (cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order))
                return;
+#endif
 
        free_contig_range(page_to_pfn(page), 1 << order);
 }
@@ -1242,7 +1243,8 @@ static struct page *alloc_gigantic_page(struct hstate *h, 
gfp_t gfp_mask,
 {
        unsigned long nr_pages = 1UL << huge_page_order(h);
 
-       if (IS_ENABLED(CONFIG_CMA)) {
+#ifdef CONFIG_CMA
+       {
                struct page *page;
                int node;
 
@@ -1256,6 +1258,7 @@ static struct page *alloc_gigantic_page(struct hstate *h, 
gfp_t gfp_mask,
                                return page;
                }
        }
+#endif
 
        return alloc_contig_pages(nr_pages, gfp_mask, nid, nodemask);
 }
-- 
2.27.0

-- 
Cheers,
Stephen Rothwell

Attachment: pgpYO6CJhOrmu.pgp
Description: OpenPGP digital signature

Reply via email to