All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Glisse <jglisse@redhat.com>
To: David Rientjes <rientjes@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Michal Hocko <mhocko@suse.com>,
	Mike Rapoport <rppt@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mmu_notifier: fix mmu_notifier_range_init warning
Date: Tue, 11 Dec 2018 16:36:36 -0500	[thread overview]
Message-ID: <20181211213636.GB6478@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1812111310320.87855@chino.kir.corp.google.com>

On Tue, Dec 11, 2018 at 01:12:54PM -0800, David Rientjes wrote:
> On Tue, 11 Dec 2018, Jerome Glisse wrote:
> 
> > On Tue, Dec 11, 2018 at 09:04:43PM +0100, Arnd Bergmann wrote:
> > > The macro version of mmu_notifier_range_init() for CONFIG_MMU_NOTIFIER=n
> > > does not evaluate all its arguments, leading to a warning in one case:
> > > 
> > > mm/migrate.c: In function 'migrate_vma_pages':
> > > mm/migrate.c:2711:20: error: unused variable 'mm' [-Werror=unused-variable]
> > >   struct mm_struct *mm = vma->vm_mm;
> > > 
> > > Pass down the 'mm' as into the inline function as well so gcc can
> > > see why the variable exists.
> > > 
> > > Fixes: 137d92bd73b1 ("mm/mmu_notifier: use structure for invalidate_range_start/end calls v2")
> > 
> > What about changing migrate.c (i actualy tried to do that everywhere in
> > the patchset but i missed that spot) So we avoid one useless variable on
> > such configuration:
> > 
> > diff --git a/mm/migrate.c b/mm/migrate.c
> > index f02bb4b22c1a..883fce631f47 100644
> > --- a/mm/migrate.c
> > +++ b/mm/migrate.c
> > @@ -2701,7 +2701,6 @@ static void migrate_vma_pages(struct migrate_vma *migrate)
> >  	const unsigned long npages = migrate->npages;
> >  	const unsigned long start = migrate->start;
> >  	struct vm_area_struct *vma = migrate->vma;
> > -	struct mm_struct *mm = vma->vm_mm;
> >  	struct mmu_notifier_range range;
> >  	unsigned long addr, i;
> >  	bool notified = false;
> > @@ -2724,8 +2723,8 @@ static void migrate_vma_pages(struct migrate_vma *migrate)
> >  			if (!notified) {
> >  				notified = true;
> >  
> > -				mmu_notifier_range_init(&range, mm, addr,
> > -							migrate->end,
> > +				mmu_notifier_range_init(&range, vma->vm_mm,
> > +							addr, migrate->end,
> >  							MMU_NOTIFY_CLEAR);
> >  				mmu_notifier_invalidate_range_start(&range);
> >  			}
> 
> Wouldn't it be better to just declare mmu_notifier_range_init() as a 
> static inline function rather than a #define to avoid this warning?

The define trick is use to drop the event parameter so that we do not
need to define the event value for CONFIG_MMU_NOTIFIER=n case.

Cheers,
Jérôme

  reply	other threads:[~2018-12-11 21:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 20:04 [PATCH] mm/mmu_notifier: fix mmu_notifier_range_init warning Arnd Bergmann
2018-12-11 20:19 ` Jerome Glisse
2018-12-11 21:12   ` David Rientjes
2018-12-11 21:36     ` Jerome Glisse [this message]
2018-12-11 21:43       ` David Rientjes
2018-12-11 21:53         ` Arnd Bergmann
2018-12-11 22:19           ` Jerome Glisse
2018-12-11 22:25           ` David Rientjes

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=20181211213636.GB6478@redhat.com \
    --to=jglisse@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=sfr@canb.auug.org.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.