Re: [PATCH] lazy freeing of memory through MADV_FREE 2/2

Ulrich Drepper
2007-04-20T21:24:57Z

On 4/20/07, Andrew Morton <akpm@linux-foundation.org> wrote:
> OK, we need to flesh this out a lot please. People often get confused
> about what our MADV_DONTNEED behaviour is.

Well, there's not really much to flesh out. The current MADV_DONTNEED
is useful in some situations. The behavior cannot be changed, even
glibc will rely on it for the case when MADV_FREE is not supported.

What might be nice to have is to have a POSIX-compliant
POSIX_MADV_DONTNEED implementation. We currently do nothing which is
OK since no test suite can detect that. But some code might want to
use the real behavior and we're missing an optimization possibility.

Just for reference: the MADV_CURRENT behavior is to throw away data in
the range. The POSIX_MADV_DONTNEED behavior is to never lose data.
I.e., file backed data is written back, anon data is at most swapped
out.