linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: "Khalid Aziz" <khalid.aziz@oracle.com>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Anthony Yznaga" <anthony.yznaga@oracle.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: remove unused variable
Date: Tue, 12 Mar 2019 14:18:54 -0700	[thread overview]
Message-ID: <20190312141854.7a06e640a611344243a25461@linux-foundation.org> (raw)
In-Reply-To: <CAMpxmJVeeMRPaXMKp29mE08pKFU4RRMetY=9-pWmazLg3DMLbg@mail.gmail.com>

On Tue, 12 Mar 2019 15:03:52 +0100 Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:

> wt., 12 mar 2019 o 14:59 Khalid Aziz <khalid.aziz@oracle.com> napisał(a):
> >
> > On 3/12/19 7:28 AM, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >
> > > The mm variable is set but unused. Remove it.
> >
> > It is used. Look further down for calls to set_pte_at().
> >
> > --
> > Khalid
> >
> > >
> > > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > > ---
> > >  mm/mprotect.c | 1 -
> > >  1 file changed, 1 deletion(-)
> > >
> > > diff --git a/mm/mprotect.c b/mm/mprotect.c
> > > index 028c724dcb1a..130dac3ad04f 100644
> > > --- a/mm/mprotect.c
> > > +++ b/mm/mprotect.c
> > > @@ -39,7 +39,6 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
> > >               unsigned long addr, unsigned long end, pgprot_t newprot,
> > >               int dirty_accountable, int prot_numa)
> > >  {
> > > -     struct mm_struct *mm = vma->vm_mm;
> > >       pte_t *pte, oldpte;
> > >       spinlock_t *ptl;
> > >       unsigned long pages = 0;
> > >
> >
> >
> 
> Oops, I blindly assumed the compiler is right, sorry for that. GCC
> complains it's unused when building usermode linux. I guess it's a
> matter of how set_pte_at() is defined for ARCH=um. I'll take a second
> look.
> 

The problem is that set_pte_at() is implemented as a macro on some
architectures.

The appropriate fix is to make all architectures use a static inline C
functions in all cases.  That will make the compiler think that the
`mm' arg is used, even if it is not.


      reply	other threads:[~2019-03-12 21:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 13:28 Bartosz Golaszewski
2019-03-12 13:58 ` Khalid Aziz
2019-03-12 14:03   ` Bartosz Golaszewski
2019-03-12 21:18     ` Andrew Morton [this message]

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=20190312141854.7a06e640a611344243a25461@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=anthony.yznaga@oracle.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=jglisse@redhat.com \
    --cc=khalid.aziz@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --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