linux-next: build failure after merge of the akpm-current tree

From: Stephen Rothwell
Date: Fri Aug 16 2013 - 02:11:47 EST


Hi Andrew,

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

mm/built-in.o: In function `.__offline_pages.constprop.10':
memory_hotplug.c:(.ref.text+0x10ec): undefined reference to `.is_hugepage_active'

Caused by commit 9a9137504d7c ("mm: memory-hotplug: enable memory hotplug
to handle hugepage").

This build has CONFIG_HUGETLB_PAGE (which exposes the declaration of
is_hugepage_active() in include/linux/hugetlb.h, but
CONFIG_MEMORY_FAILURE unset (which hides the definition of
is_hugepage_active() in mm/hugetlb.c.

The single caller (in mm/memory_hotplug.c) is protected by
CONFIG_MEMORY_HOTREMOVE.

I have applied this patch for today (which may also not work in every
case):

From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Date: Fri, 16 Aug 2013 16:06:19 +1000
Subject: [PATCH] mm: move is_hugepage_active() outside protecting ifdef

Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
---
mm/hugetlb.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 0dc8ef9..38bc25b 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3434,22 +3434,6 @@ follow_huge_pud(struct mm_struct *mm, unsigned long address,

#endif /* CONFIG_ARCH_WANT_GENERAL_HUGETLB */

-#ifdef CONFIG_MEMORY_FAILURE
-
-/* Should be called in hugetlb_lock */
-static int is_hugepage_on_freelist(struct page *hpage)
-{
- struct page *page;
- struct page *tmp;
- struct hstate *h = page_hstate(hpage);
- int nid = page_to_nid(hpage);
-
- list_for_each_entry_safe(page, tmp, &h->hugepage_freelists[nid], lru)
- if (page == hpage)
- return 1;
- return 0;
-}
-
bool is_hugepage_active(struct page *page)
{
VM_BUG_ON(!PageHuge(page));
@@ -3472,6 +3456,22 @@ bool is_hugepage_active(struct page *page)
return page_count(page) > 0;
}

+#ifdef CONFIG_MEMORY_FAILURE
+
+/* Should be called in hugetlb_lock */
+static int is_hugepage_on_freelist(struct page *hpage)
+{
+ struct page *page;
+ struct page *tmp;
+ struct hstate *h = page_hstate(hpage);
+ int nid = page_to_nid(hpage);
+
+ list_for_each_entry_safe(page, tmp, &h->hugepage_freelists[nid], lru)
+ if (page == hpage)
+ return 1;
+ return 0;
+}
+
/*
* This function is called from memory failure code.
* Assume the caller holds page lock of the head page.
--
1.8.4.rc0

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx
http://www.canb.auug.org.au/~sfr/

Attachment: pgp00000.pgp
Description: PGP signature