linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jason Gunthorpe <jgg@mellanox.com>
Cc: Jerome Glisse <jglisse@redhat.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH] hmm: Suppress compilation warnings when CONFIG_HUGETLB_PAGE is not set
Date: Wed, 22 May 2019 13:23:22 -0700	[thread overview]
Message-ID: <20190522132322.15605c8b344f46b31ea8233b@linux-foundation.org> (raw)
In-Reply-To: <20190522195151.GA23955@ziepe.ca>

On Wed, 22 May 2019 19:51:55 +0000 Jason Gunthorpe <jgg@mellanox.com> wrote:

> gcc reports that several variables are defined but not used.
> 
> For the first hunk CONFIG_HUGETLB_PAGE the entire if block is already
> protected by pud_huge() which is forced to 0. None of the stuff under
> the ifdef causes compilation problems as it is already stubbed out in
> the header files.
> 
> For the second hunk the dummy huge_page_shift macro doesn't touch the
> argument, so just inline the argument.
> 
> ...
>
> --- a/mm/hmm.c
> +++ b/mm/hmm.c
> @@ -797,7 +797,6 @@ static int hmm_vma_walk_pud(pud_t *pudp,
>  			return hmm_vma_walk_hole_(addr, end, fault,
>  						write_fault, walk);
>  
> -#ifdef CONFIG_HUGETLB_PAGE
>  		pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
>  		for (i = 0; i < npages; ++i, ++pfn) {
>  			hmm_vma_walk->pgmap = get_dev_pagemap(pfn,
> @@ -813,9 +812,6 @@ static int hmm_vma_walk_pud(pud_t *pudp,
>  		}
>  		hmm_vma_walk->last = end;
>  		return 0;
> -#else
> -		return -EINVAL;
> -#endif
>  	}

Fair enough.

>  	split_huge_pud(walk->vma, pudp, addr);
> @@ -1024,9 +1020,8 @@ long hmm_range_snapshot(struct hmm_range *range)
>  			return -EFAULT;
>  
>  		if (is_vm_hugetlb_page(vma)) {
> -			struct hstate *h = hstate_vma(vma);
> -
> -			if (huge_page_shift(h) != range->page_shift &&
> +			if (huge_page_shift(hstate_vma(vma)) !=
> +				    range->page_shift &&
>  			    range->page_shift != PAGE_SHIFT)
>  				return -EINVAL;

Also fair enough.  But why the heck is huge_page_shift() a macro?  We
keep doing that and it bites so often :(


  reply	other threads:[~2019-05-22 20:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 19:51 Jason Gunthorpe
2019-05-22 20:23 ` Andrew Morton [this message]
2019-05-22 23:51   ` Jason Gunthorpe
2019-05-23 17:56     ` Mike Kravetz
2019-05-23 23:49       ` Ira Weiny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190522132322.15605c8b344f46b31ea8233b@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=jgg@mellanox.com \
    --cc=jglisse@redhat.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox