All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Rik van Riel <riel@redhat.com>,
	Ulrich Drepper <drepper@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] MM: implement MADV_FREE lazy freeing of anonymous memory
Date: Tue, 8 May 2007 14:35:28 -0400	[thread overview]
Message-ID: <20070508183528.GM355@devserv.devel.redhat.com> (raw)
In-Reply-To: <464014B0.7060308@yahoo.com.au>

On Tue, May 08, 2007 at 04:12:00PM +1000, Nick Piggin wrote:
> I didn't actually check system and user times for the mysql
> benchmark, but that's exactly what I had in mind when I
> mentioned the poor cache behaviour this patch could cause. I
> definitely did see user times go up in benchmarks where I
> measured.
> 
> We have percpu and cache affine page allocators, so when
> userspace just frees a page, it is likely to be cache hot, so
> we want to free it up so it can be reused by this CPU ASAP.
> Likewise, when we newly allocate a page, we want it to be one
> that is cache hot on this CPU.

malloc has per-thread arenas, so when using MADV_FREE the pages
should be local to the thread as well (unless the thread has switched
to a different CPU also to the CPU) and in case of sysbench should
be cache hot as well (it is reused RSN).  With MADV_DONTNEED you need to
clear the pages while that is not necessary with MADV_FREE.

	Jakub

WARNING: multiple messages have this Message-ID (diff)
From: Jakub Jelinek <jakub@redhat.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Rik van Riel <riel@redhat.com>,
	Ulrich Drepper <drepper@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] MM: implement MADV_FREE lazy freeing of anonymous memory
Date: Tue, 8 May 2007 14:35:28 -0400	[thread overview]
Message-ID: <20070508183528.GM355@devserv.devel.redhat.com> (raw)
In-Reply-To: <464014B0.7060308@yahoo.com.au>

On Tue, May 08, 2007 at 04:12:00PM +1000, Nick Piggin wrote:
> I didn't actually check system and user times for the mysql
> benchmark, but that's exactly what I had in mind when I
> mentioned the poor cache behaviour this patch could cause. I
> definitely did see user times go up in benchmarks where I
> measured.
> 
> We have percpu and cache affine page allocators, so when
> userspace just frees a page, it is likely to be cache hot, so
> we want to free it up so it can be reused by this CPU ASAP.
> Likewise, when we newly allocate a page, we want it to be one
> that is cache hot on this CPU.

malloc has per-thread arenas, so when using MADV_FREE the pages
should be local to the thread as well (unless the thread has switched
to a different CPU also to the CPU) and in case of sysbench should
be cache hot as well (it is reused RSN).  With MADV_DONTNEED you need to
clear the pages while that is not necessary with MADV_FREE.

	Jakub

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2007-05-08 18:35 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-28  4:43 [PATCH] MM: implement MADV_FREE lazy freeing of anonymous memory Rik van Riel
2007-05-04 10:53 ` Nick Piggin
2007-05-04 10:53   ` Nick Piggin
2007-05-04 11:58   ` Rik van Riel
2007-05-04 11:58     ` Rik van Riel
2007-05-04 23:49     ` Nick Piggin
2007-05-04 23:49       ` Nick Piggin
2007-05-04 16:04   ` Ulrich Drepper
2007-05-04 23:47     ` Nick Piggin
2007-05-04 23:47       ` Nick Piggin
2007-05-05  0:10       ` Ulrich Drepper
2007-05-06 22:43       ` Rik van Riel
2007-05-06 22:43         ` Rik van Riel
2007-05-07  2:42         ` Ulrich Drepper
2007-05-07  2:42           ` Ulrich Drepper
2007-05-07  4:56           ` Rik van Riel
2007-05-07  4:56             ` Rik van Riel
2007-05-07  4:53             ` Ulrich Drepper
2007-05-07  4:53               ` Ulrich Drepper
2007-05-07 16:51               ` Rik van Riel
2007-05-07 16:51                 ` Rik van Riel
2007-05-08  6:12         ` Nick Piggin
2007-05-08  6:12           ` Nick Piggin
2007-05-08 14:59           ` Rik van Riel
2007-05-08 14:59             ` Rik van Riel
2007-05-08 23:23             ` Nick Piggin
2007-05-08 23:23               ` Nick Piggin
2007-05-08 18:35           ` Jakub Jelinek [this message]
2007-05-08 18:35             ` Jakub Jelinek
2007-05-08 23:43             ` Nick Piggin
2007-05-08 23:43               ` Nick Piggin
2007-05-08  3:51       ` [PATCH] stub MADV_FREE implementation Rik van Riel
2007-05-08 23:05         ` Andrew Morton
2007-05-08 23:05           ` Andrew Morton
2007-05-09 17:15           ` Ulrich Drepper
2007-05-09 17:15             ` Ulrich Drepper
2007-05-09 16:38     ` [PATCH] MM: implement MADV_FREE lazy freeing of anonymous memory Hugh Dickins
2007-05-09 16:38       ` Hugh Dickins
2007-05-29 16:59   ` Rik van Riel
2007-05-29 16:59     ` Rik van Riel

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=20070508183528.GM355@devserv.devel.redhat.com \
    --to=jakub@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=riel@redhat.com \
    --cc=torvalds@linux-foundation.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 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.