Subject: linux-next: build failure after merge of the akpm_current tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 17 Jul 2020 21:31:27 +1000

Hi all,

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

mm/hugetlb.c:1302:20: error: redefinition of 'destroy_compound_gigantic_page'
 1302 | static inline void destroy_compound_gigantic_page(struct hstate *h,
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/hugetlb.c:1223:13: note: previous definition of 'destroy_compound_gigantic_page' was here
 1223 | static void destroy_compound_gigantic_page(struct hstate *h, struct page *page,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Caused by commit

  d8d718553f84 ("mm,hwpoison: rework soft offline for in-use pages")

The preprocessor directives look like this:

static void destroy_compound_gigantic_page(struct hstate *h, struct page *page,
#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
#ifdef CONFIG_CONTIG_ALLOC
#else /* !CONFIG_CONTIG_ALLOC */
#endif /* CONFIG_CONTIG_ALLOC */
#else /* !CONFIG_ARCH_HAS_GIGANTIC_PAGE */
static inline void destroy_compound_gigantic_page(struct hstate *h,
#endif

So, for now, I have applied the following hack to get it to build.

From: Stephen Rothwell <[email-masked]>
Date: Fri, 17 Jul 2020 21:17:37 +1000
Subject: [PATCH] fix up for hugetlb.c code movement

Fuxes: "mm,hwpoison: rework soft offline for in-use pages"
Signed-off-by: Stephen Rothwell <[email-masked]>
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 1fe5f7229b24..589c330df4db 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1220,6 +1220,7 @@ static inline void ClearPageHugePoisoned(struct page *page)
 	page[3].mapping = NULL;
 }
 
+#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
 static void destroy_compound_gigantic_page(struct hstate *h, struct page *page,
 					   unsigned int order)
 {
@@ -1244,7 +1245,6 @@ static void destroy_compound_gigantic_page(struct hstate *h, struct page *page,
 	__ClearPageHead(page);
 }
 
-#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
 static void free_gigantic_page(struct page *page, unsigned int order)
 {
 	/*
-- 
2.27.0

-- 
Cheers,
Stephen Rothwell