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

From: Mike Kravetz <[email-masked]>
Date: Wed, 22 Jun 2022 09:39:46 -0700

On 06/22/22 17:11, Stephen Rothwell wrote:
> Hi all,
> 
> On Wed, 22 Jun 2022 15:54:08 +1000 Stephen Rothwell <[email-masked]> wrote:
> > 
> > After merging the mm tree, today's linux-next build (powerpc
> > ppc64_defconfig) produced this warning:
> > 
> > mm/hugetlb.c: In function 'hugetlb_mask_last_page':
> > mm/hugetlb.c:6908:23: warning: unused variable 'hp_size' [-Wunused-variable]
> >  6908 |         unsigned long hp_size = huge_page_size(h);
> >       |                       ^~~~~~~
> > 
> > Introduced by commit
> > 
> >   76005bedbc32 ("hugetlb: do not update address in huge_pmd_unshare")
> 
> This became a build failure in my powerpc allyesconfig build, so I
> applied this patch:
> 
> From: Stephen Rothwell <[email-masked]>
> Date: Wed, 22 Jun 2022 17:04:46 +1000
> Subject: [PATCH] hugetlb: fix an unused variable warning/error
> 
> Signed-off-by: Stephen Rothwell <[email-masked]>
> ---
>  mm/hugetlb.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 2e4a92cebd9c..f338640fbe4a 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -6905,10 +6905,8 @@ unsigned long hugetlb_mask_last_page(struct hstate *h)
>  /* See description above.  Architectures can provide their own version. */
>  __weak unsigned long hugetlb_mask_last_page(struct hstate *h)
>  {
> -	unsigned long hp_size = huge_page_size(h);
> -
>  #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
> -	if (hp_size == PMD_SIZE)
> +	if (huge_page_size(h) == PMD_SIZE)
>  		return PUD_SIZE - PMD_SIZE;
>  #endif
>  	return 0UL;
> -- 

Thanks Stephen,  my bad for not building !CONFIG_ARCH_WANT_HUGE_PMD_SHARE and,
the error is pretty obvious. :(

Andrew, do you want me to send an updated version of the patch?  Or,
would you prefer to include Stephen's fix?
-- 
Mike Kravetz