Subject: Re: linux-next: build warning after merge of the akpm-current tree

From: Feng Tang <[email-masked]>
Date: Mon, 19 Jul 2021 16:47:52 +0800

Hi Stephen,

On Mon, Jul 19, 2021 at 05:52:03PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the akpm-current tree, today's linux-next build (i386
> defconfig) produced this warning:
> 
> mm/hugetlb.c: In function 'dequeue_huge_page_vma':
> mm/hugetlb.c:1180:1: warning: label 'check_reserve' defined but not used [-Wunused-label]
>  1180 | check_reserve:
>       | ^~~~~~~~~~~~~
> 
> Introduced by commit
> 
>   df178183cf05 ("mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY")

Thanks for the report!

The below patch should fix it (Also attached).

Andrew,

Could you help to fold it to the 4/6 of patchset of "introducing
multi-preference memplicy":
  [PATCH v6 4/6] mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY 

Thanks!

- Feng

--------------------------------8<-----------------------------------

>From 4d3b4b0037bf4e1eacae4886387ffe4af90f5a1f Mon Sep 17 00:00:00 2001
From: Feng Tang <[email-masked]>
Date: Mon, 19 Jul 2021 16:24:23 +0800
Subject: [PATCH] mm/hugetlb: fix compile warning for !CONFIG_NUMA build

Stephen Rothwell reported the i386 build with CONFIG_NUMA=n
will have a warning:

mm/hugetlb.c: In function 'dequeue_huge_page_vma':
mm/hugetlb.c:1180:1: warning: label 'check_reserve' defined but not used [-Wunused-label]
 1180 | check_reserve:
       | ^~~~~~~~~~~~~

introduced by commit
    df178183cf05 ("mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY")

Signed-off-by: Feng Tang <[email-masked]>
---
 mm/hugetlb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ae1a39e11bcf..528947da65c8 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1177,7 +1177,9 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
 #endif
 	page = dequeue_huge_page_nodemask(h, gfp_mask, nid, nodemask);
 
+#ifdef CONFIG_NUMA
 check_reserve:
+#endif
 	if (page && !avoid_reserve && vma_has_reserves(vma, chg)) {
 		SetHPageRestoreReserve(page);
 		h->resv_huge_pages--;
-- 
2.7.4

> -- 
> Cheers,
> Stephen Rothwell

>From 4d3b4b0037bf4e1eacae4886387ffe4af90f5a1f Mon Sep 17 00:00:00 2001
From: Feng Tang <[email-masked]>
Date: Mon, 19 Jul 2021 16:24:23 +0800
Subject: [PATCH] mm/hugetlb: fix compile warning for !CONFIG_NUMA build

Stephen Rothwell reported the i386 build with CONFIG_NUMA=n
will have a warning:

mm/hugetlb.c: In function 'dequeue_huge_page_vma':
mm/hugetlb.c:1180:1: warning: label 'check_reserve' defined but not used [-Wunused-label]
 1180 | check_reserve:
       | ^~~~~~~~~~~~~

introduced by commit
    df178183cf05 ("mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY")

Signed-off-by: Feng Tang <[email-masked]>
---
 mm/hugetlb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ae1a39e11bcf..528947da65c8 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1177,7 +1177,9 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
 #endif
 	page = dequeue_huge_page_nodemask(h, gfp_mask, nid, nodemask);
 
+#ifdef CONFIG_NUMA
 check_reserve:
+#endif
 	if (page && !avoid_reserve && vma_has_reserves(vma, chg)) {
 		SetHPageRestoreReserve(page);
 		h->resv_huge_pages--;
-- 
2.7.4