Re: [PATCH -mm] vmscan: make mapped executable pages the first class citizen

Elladan
2009-05-08T22:56:18Z

On Fri, May 08, 2009 at 03:15:32PM -0700, Andrew Morton wrote:
> On Fri, 8 May 2009 23:00:45 +0100
> Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>
> > > The patch seems reasonable but the changelog and the (non-existent)
> > > design documentation could do with a touch-up.
> >
> > Is it right that I as a user can do things like mmap my database
> > PROT_EXEC to get better database numbers by making other
> > stuff swap first ?
> >
> > You seem to be giving everyone a "nice my process up" hack.
>
> Yep.
>
> But prior to 2.6.27(?) the same effect could be had by mmap()ing the
> file with or without PROT_EXEC. The patch restores a
> probably-beneficial heuristic which got lost in the LRU rewrite.
>
> So we're no worse than pre-2.6.27 kernels here. Plus there are
> probably more effective ways of getting that sort of boost, such as
> having a process running which simply touches your favoured pages
> at a suitable (and fairly low) frequency.

An example of a process which does this automatically is the Java virtual
machine (and probably other runtimes which use a mark and sweep type GC).

You can see this in practice pretty easily -- a jvm process will automatically
keep its memory paged in, even under strong VM pressure.

-E