All of lore.kernel.org
 help / color / mirror / Atom feed
* very small code cleanup
@ 2006-11-07 14:30 Rik Bobbaers
  2006-11-07 14:43 ` Paulo Marques
  0 siblings, 1 reply; 3+ messages in thread
From: Rik Bobbaers @ 2006-11-07 14:30 UTC (permalink / raw)
  To: linux-kernel, linux-mm

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
Rik.Bobbaers@cc.kuleuven.be -=- 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: very small code cleanup
  2006-11-07 14:30 very small code cleanup Rik Bobbaers
@ 2006-11-07 14:43 ` Paulo Marques
  2006-11-07 15:11   ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Paulo Marques @ 2006-11-07 14:43 UTC (permalink / raw)
  To: Rik Bobbaers; +Cc: linux-kernel, linux-mm

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 - www.grupopie.com

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: very small code cleanup
  2006-11-07 14:43 ` Paulo Marques
@ 2006-11-07 15:11   ` Hugh Dickins
  0 siblings, 0 replies; 3+ messages in thread
From: Hugh Dickins @ 2006-11-07 15:11 UTC (permalink / raw)
  To: Paulo Marques; +Cc: Rik Bobbaers, linux-kernel, linux-mm

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-07 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-07 14:30 very small code cleanup Rik Bobbaers
2006-11-07 14:43 ` Paulo Marques
2006-11-07 15:11   ` Hugh Dickins

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.