* [PATCH] mm: remove unused variable
@ 2019-03-12 13:28 Bartosz Golaszewski
2019-03-12 13:58 ` Khalid Aziz
0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2019-03-12 13:28 UTC (permalink / raw)
To: Andrew Morton, Anthony Yznaga, Khalid Aziz, Aneesh Kumar K . V,
Jérôme Glisse
Cc: linux-mm, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The mm variable is set but unused. Remove it.
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;
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: remove unused variable
2019-03-12 13:28 [PATCH] mm: remove unused variable Bartosz Golaszewski
@ 2019-03-12 13:58 ` Khalid Aziz
2019-03-12 14:03 ` Bartosz Golaszewski
0 siblings, 1 reply; 4+ messages in thread
From: Khalid Aziz @ 2019-03-12 13:58 UTC (permalink / raw)
To: Bartosz Golaszewski, Andrew Morton, Anthony Yznaga,
Aneesh Kumar K . V, Jérôme Glisse
Cc: linux-mm, linux-kernel, Bartosz Golaszewski
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;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: remove unused variable
2019-03-12 13:58 ` Khalid Aziz
@ 2019-03-12 14:03 ` Bartosz Golaszewski
2019-03-12 21:18 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2019-03-12 14:03 UTC (permalink / raw)
To: Khalid Aziz
Cc: Bartosz Golaszewski, Andrew Morton, Anthony Yznaga,
Aneesh Kumar K . V, Jérôme Glisse, linux-mm, LKML
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.
Bart
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: remove unused variable
2019-03-12 14:03 ` Bartosz Golaszewski
@ 2019-03-12 21:18 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2019-03-12 21:18 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Khalid Aziz, Bartosz Golaszewski, Anthony Yznaga,
Aneesh Kumar K . V, Jérôme Glisse, linux-mm, LKML
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-12 21:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12 13:28 [PATCH] mm: remove unused variable Bartosz Golaszewski
2019-03-12 13:58 ` Khalid Aziz
2019-03-12 14:03 ` Bartosz Golaszewski
2019-03-12 21:18 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).