Subject: Re: linux-next: build warning after merge of the final tree (hwpoison tree related)

From: Wu Fengguang <[email-masked]>
Date: Mon, 27 Sep 2010 14:56:18 +0800

Hi Stephen,

On Mon, Sep 27, 2010 at 01:28:04PM +0800, Stephen Rothwell wrote:
> Hi Andi,
> 
> After merging the final tree, today's linux-next build (powerpc
> ppc64_defconfig) produced this warning:
> 
> mm/hugetlb.c:2950: warning: 'is_hugepage_on_freelist' defined but not used
> 
> Introduced by commit 19b31e29073e272e49a3d38972c132c49383d5d4 ("HWPOISON,
> hugetlb: add free check to dequeue_hwpoison_huge_page()").

Maybe ppc64_defconfig does not enable CONFIG_MEMORY_FAILURE.
Try this trivial patch :)

Thanks,
Fengguang
---
hugetlb: fix is_hugepage_on_freelist() build warning

mm/hugetlb.c:2950: warning: 'is_hugepage_on_freelist' defined but not used                                                         

Reported-by: Stephen Rothwell <[email-masked]>
Signed-off-by: Wu Fengguang <[email-masked]>
---
 mm/hugetlb.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- linux-next.orig/mm/hugetlb.c	2010-09-27 14:51:19.000000000 +0800
+++ linux-next/mm/hugetlb.c	2010-09-27 14:52:56.000000000 +0800
@@ -2876,8 +2876,8 @@ void hugetlb_unreserve_pages(struct inod
 	hugetlb_acct_memory(h, -(chg - freed));
 }
 
-/* Should be called in hugetlb_lock */
-static int is_hugepage_on_freelist(struct page *hpage)
+#ifdef CONFIG_MEMORY_FAILURE
+static int __is_hugepage_on_freelist(struct page *hpage)
 {
 	struct page *page;
 	struct page *tmp;
@@ -2890,7 +2890,6 @@ static int is_hugepage_on_freelist(struc
 	return 0;
 }
 
-#ifdef CONFIG_MEMORY_FAILURE
 /*
  * This function is called from memory failure code.
  * Assume the caller holds page lock of the head page.
@@ -2902,7 +2901,7 @@ int dequeue_hwpoisoned_huge_page(struct 
 	int ret = -EBUSY;
 
 	spin_lock(&hugetlb_lock);
-	if (is_hugepage_on_freelist(hpage)) {
+	if (__is_hugepage_on_freelist(hpage)) {
 		list_del(&hpage->lru);
 		h->free_huge_pages--;
 		h->free_huge_pages_node[nid]--;