2006-11-07 14:30:11

by Rik Bobbaers

[permalink] [raw]
Subject: very small code cleanup

hey all,

in mm/mlock.c , mm is defined as vma->vm_mm, why not use that one for
the decrement of pages?

proposed patch:
---------------
--- mm/mlock.c~ 2006-11-04 02:33:58.000000000 +0100
+++ mm/mlock.c 2006-11-07 15:23:48.000000000 +0100
@@ -65,7 +65,7 @@ success:
ret = make_pages_present(start, end);
}

- vma->vm_mm->locked_vm -= pages;
+ mm->locked_vm -= pages;
out:
if (ret == -ENOMEM)
ret = -EAGAIN;

---------------

tnx...

--
harry
aka Rik Bobbaers

K.U.Leuven - LUDIT -=- Tel: +32 485 52 71 50
[email protected] -=- http://people.linux-vserver.org/~harry

thinking always leads to conclusions... and those can be extremely dangerous
-- me ;)

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


2006-11-07 14:43:40

by Paulo Marques

[permalink] [raw]
Subject: Re: very small code cleanup

Rik Bobbaers wrote:
> hey all,
>
> in mm/mlock.c , mm is defined as vma->vm_mm, why not use that one for
> the decrement of pages?

Because vma can change here:

if (*prev) {
vma = *prev;
goto success;
}

and then mm won't be the same as vma->vm_mm..

--
Paulo Marques - http://www.grupopie.com

"The face of a child can say it all, especially the
mouth part of the face."

2006-11-07 15:11:25

by Hugh Dickins

[permalink] [raw]
Subject: Re: very small code cleanup

On Tue, 7 Nov 2006, Paulo Marques wrote:
> Rik Bobbaers wrote:
> >
> > in mm/mlock.c , mm is defined as vma->vm_mm, why not use that one for the
> > decrement of pages?
>
> Because vma can change here:
>
> if (*prev) {
> vma = *prev;
> goto success;
> }

That's a good piece of cautious observation ...

>
> and then mm won't be the same as vma->vm_mm..

... but it would be a bug if *prev's vm_mm were different from mm
and from the original vma->vm_mm: Rik's patch looks sensible to me.

Hugh