linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* mm: Do not drain pagevecs for mlockall(MCL_FUTURE)
@ 2011-10-07 20:32 Christoph Lameter
  2011-10-08  2:45 ` David Rientjes
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Christoph Lameter @ 2011-10-07 20:32 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, Mel Gorman

MCL_FUTURE does not move pages between lru list and draining the LRU per
cpu pagevecs is a nasty activity. Avoid doing it unecessarily.

Signed-off-by: Christoph Lameter <cl@gentwo.org>


---
 mm/mlock.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/mm/mlock.c
===================================================================
--- linux-2.6.orig/mm/mlock.c	2011-10-07 14:57:52.000000000 -0500
+++ linux-2.6/mm/mlock.c	2011-10-07 15:01:06.000000000 -0500
@@ -549,7 +549,8 @@ SYSCALL_DEFINE1(mlockall, int, flags)
 	if (!can_do_mlock())
 		goto out;

-	lru_add_drain_all();	/* flush pagevec */
+	if (flags & MCL_CURRENT)
+		lru_add_drain_all();	/* flush pagevec */

 	down_write(&current->mm->mmap_sem);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mm: Do not drain pagevecs for mlockall(MCL_FUTURE)
  2011-10-07 20:32 mm: Do not drain pagevecs for mlockall(MCL_FUTURE) Christoph Lameter
@ 2011-10-08  2:45 ` David Rientjes
  2011-10-08  4:28   ` Michel Lespinasse
  2011-10-08  9:43 ` Minchan Kim
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: David Rientjes @ 2011-10-08  2:45 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: akpm, linux-mm, Mel Gorman

On Fri, 7 Oct 2011, Christoph Lameter wrote:

> MCL_FUTURE does not move pages between lru list and draining the LRU per
> cpu pagevecs is a nasty activity. Avoid doing it unecessarily.
> 
> Signed-off-by: Christoph Lameter <cl@gentwo.org>
> 
> 
> ---
>  mm/mlock.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/mm/mlock.c
> ===================================================================
> --- linux-2.6.orig/mm/mlock.c	2011-10-07 14:57:52.000000000 -0500
> +++ linux-2.6/mm/mlock.c	2011-10-07 15:01:06.000000000 -0500
> @@ -549,7 +549,8 @@ SYSCALL_DEFINE1(mlockall, int, flags)
>  	if (!can_do_mlock())
>  		goto out;
> 
> -	lru_add_drain_all();	/* flush pagevec */
> +	if (flags & MCL_CURRENT)
> +		lru_add_drain_all();	/* flush pagevec */

I understand the intention of lru_add_drain_all() to try to avoid a 
later failure when moving to the unevictable list and why flushing it's 
necessary for MCL_FUTURE, but I think this should be written

	if (!(flags & MCL_FUTURE))
		...

since flags may be extended sometime in the future.  After that's fixed, 
feel free to add my

	Acked-by: David Rientjes <rientjes@google.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mm: Do not drain pagevecs for mlockall(MCL_FUTURE)
  2011-10-08  2:45 ` David Rientjes
@ 2011-10-08  4:28   ` Michel Lespinasse
  0 siblings, 0 replies; 6+ messages in thread
From: Michel Lespinasse @ 2011-10-08  4:28 UTC (permalink / raw)
  To: David Rientjes; +Cc: Christoph Lameter, akpm, linux-mm, Mel Gorman

On Fri, Oct 7, 2011 at 7:45 PM, David Rientjes <rientjes@google.com> wrote:
> On Fri, 7 Oct 2011, Christoph Lameter wrote:
>> -     lru_add_drain_all();    /* flush pagevec */
>> +     if (flags & MCL_CURRENT)
>> +             lru_add_drain_all();    /* flush pagevec */
>
> I understand the intention of lru_add_drain_all() to try to avoid a
> later failure when moving to the unevictable list and why flushing it's
> necessary for MCL_FUTURE, but I think this should be written
>
>        if (!(flags & MCL_FUTURE))
>                ...
>
> since flags may be extended sometime in the future.

When flags == (MCL_CURRENT | MCL_FUTURE), we do want to flush the
pagevecs as in the straight MCL_CURRENT case, so I think Christoph's
version is the correct one.

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mm: Do not drain pagevecs for mlockall(MCL_FUTURE)
  2011-10-07 20:32 mm: Do not drain pagevecs for mlockall(MCL_FUTURE) Christoph Lameter
  2011-10-08  2:45 ` David Rientjes
@ 2011-10-08  9:43 ` Minchan Kim
  2011-10-10 16:15 ` KOSAKI Motohiro
  2011-10-12 14:57 ` Johannes Weiner
  3 siblings, 0 replies; 6+ messages in thread
From: Minchan Kim @ 2011-10-08  9:43 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: akpm, linux-mm, Mel Gorman

On Fri, Oct 07, 2011 at 03:32:13PM -0500, Christoph Lameter wrote:
> MCL_FUTURE does not move pages between lru list and draining the LRU per
> cpu pagevecs is a nasty activity. Avoid doing it unecessarily.
> 
> Signed-off-by: Christoph Lameter <cl@gentwo.org>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>

-- 
Kinds regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mm: Do not drain pagevecs for mlockall(MCL_FUTURE)
  2011-10-07 20:32 mm: Do not drain pagevecs for mlockall(MCL_FUTURE) Christoph Lameter
  2011-10-08  2:45 ` David Rientjes
  2011-10-08  9:43 ` Minchan Kim
@ 2011-10-10 16:15 ` KOSAKI Motohiro
  2011-10-12 14:57 ` Johannes Weiner
  3 siblings, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2011-10-10 16:15 UTC (permalink / raw)
  To: cl; +Cc: akpm, linux-mm, mel

(10/7/2011 4:32 PM), Christoph Lameter wrote:
> MCL_FUTURE does not move pages between lru list and draining the LRU per
> cpu pagevecs is a nasty activity. Avoid doing it unecessarily.
> 
> Signed-off-by: Christoph Lameter <cl@gentwo.org>
> 
> 
> ---
>  mm/mlock.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/mm/mlock.c
> ===================================================================
> --- linux-2.6.orig/mm/mlock.c	2011-10-07 14:57:52.000000000 -0500
> +++ linux-2.6/mm/mlock.c	2011-10-07 15:01:06.000000000 -0500
> @@ -549,7 +549,8 @@ SYSCALL_DEFINE1(mlockall, int, flags)
>  	if (!can_do_mlock())
>  		goto out;
> 
> -	lru_add_drain_all();	/* flush pagevec */
> +	if (flags & MCL_CURRENT)
> +		lru_add_drain_all();	/* flush pagevec */
> 
>  	down_write(&current->mm->mmap_sem);

Looks good to me. I guess I introduced this fault. sorry about that.

Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>




--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mm: Do not drain pagevecs for mlockall(MCL_FUTURE)
  2011-10-07 20:32 mm: Do not drain pagevecs for mlockall(MCL_FUTURE) Christoph Lameter
                   ` (2 preceding siblings ...)
  2011-10-10 16:15 ` KOSAKI Motohiro
@ 2011-10-12 14:57 ` Johannes Weiner
  3 siblings, 0 replies; 6+ messages in thread
From: Johannes Weiner @ 2011-10-12 14:57 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: akpm, linux-mm, Mel Gorman

On Fri, Oct 07, 2011 at 03:32:13PM -0500, Christoph Lameter wrote:
> MCL_FUTURE does not move pages between lru list and draining the LRU per
> cpu pagevecs is a nasty activity. Avoid doing it unecessarily.
> 
> Signed-off-by: Christoph Lameter <cl@gentwo.org>

Acked-by: Johannes Weiner <jweiner@redhat.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2011-10-12 14:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-07 20:32 mm: Do not drain pagevecs for mlockall(MCL_FUTURE) Christoph Lameter
2011-10-08  2:45 ` David Rientjes
2011-10-08  4:28   ` Michel Lespinasse
2011-10-08  9:43 ` Minchan Kim
2011-10-10 16:15 ` KOSAKI Motohiro
2011-10-12 14:57 ` Johannes Weiner

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).