[PATCH] lazy freeing of memory through MADV_FREE

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Rik van Riel
Date: Tuesday, April 17, 2007 - 12:15 am

Make it possible for applications to have the kernel free memory
lazily.  This reduces a repeated free/malloc cycle from freeing
pages and allocating them, to just marking them freeable.  If the
application wants to reuse them before the kernel needs the memory,
not even a page fault will happen.

This patch, together with Ulrich's glibc change, increases
MySQL sysbench performance by a factor of 2 on my quad core
test system.

Signed-off-by: Rik van Riel <riel@redhat.com>

---
Ulrich Drepper has test glibc RPMS for this functionality at:

     http://people.redhat.com/drepper/rpms

Andrew, I have stress tested this patch for a few days now and
have not been able to find any more bugs.  I believe it is ready
to be merged in -mm, and upstream at the next merge window.

When the patch goes upstream, I will submit a small follow-up
patch to revert MADV_DONTNEED behaviour to what it did previously
and have the new behaviour trigger only on MADV_FREE: at that
point people will have to get new test RPMs of glibc.
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Tue Apr 17, 12:15 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Andrew Morton, (Fri Apr 20, 1:57 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE 2/2, Andrew Morton, (Fri Apr 20, 2:03 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE 2/2, Ulrich Drepper, (Fri Apr 20, 2:24 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Fri Apr 20, 2:38 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Andrew Morton, (Fri Apr 20, 3:06 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Fri Apr 20, 4:52 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Eric Dumazet, (Fri Apr 20, 5:48 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Fri Apr 20, 8:58 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Jakub Jelinek, (Sat Apr 21, 12:12 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Hugh Dickins, (Sat Apr 21, 12:24 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE 2/2, Hugh Dickins, (Sat Apr 21, 12:37 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE 2/2, Ulrich Drepper, (Sat Apr 21, 9:32 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Sat Apr 21, 11:06 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Sat Apr 21, 7:36 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Sat Apr 21, 7:50 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Sat Apr 21, 11:31 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Andrew Morton, (Sun Apr 22, 1:18 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Christoph Hellwig, (Sun Apr 22, 2:16 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Ulrich Drepper, (Sun Apr 22, 9:55 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Sun Apr 22, 5:16 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Sun Apr 22, 8:53 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Sun Apr 22, 8:58 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Sun Apr 22, 8:59 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Sun Apr 22, 9:28 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Sun Apr 22, 9:36 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Mon Apr 23, 2:20 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Mon Apr 23, 3:07 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Mon Apr 23, 3:12 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Mon Apr 23, 3:21 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Mon Apr 23, 3:31 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Mon Apr 23, 3:35 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Jakub Jelinek, (Mon Apr 23, 3:44 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Mon Apr 23, 3:44 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Mon Apr 23, 4:45 am)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Mon Apr 23, 6:15 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Mon Apr 23, 6:58 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Nick Piggin, (Mon Apr 23, 7:16 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Mon Apr 23, 7:53 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Andrew Morton, (Mon Apr 23, 8:08 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Paul Mackerras, (Mon Apr 23, 9:42 pm)
Re: [PATCH] lazy freeing of memory through MADV_FREE, Rik van Riel, (Mon Apr 23, 10:13 pm)