memrlimit controller merge to mainline

Paul Menage menage at
Fri Jul 25 12:24:09 PDT 2008

On Fri, Jul 25, 2008 at 12:46 PM, Hugh Dickins <hugh at> wrote:
> No, I'm trying to say something stronger than that.  I'm saying,
> as I've said before, that I cannot imagine why anyone would want
> to control swap itself - what they want to control is the total
> of mem+swap.  Swap is a second-class citizen, nobody wants swap
> if they can have mem, so why control it separately?

Scheduling jobs on to machines is much more straightforward when they
request xGB of memory and yGB of swap rather than just (x+y)GB of
(memory+swap). We want to be able to guarantee to jobs that they will
be able to use xGB of real memory.

Actually my preferred approach to swap controlling would be something like:

- allow malloc to support mmaping pages from a temporary file rather
than mmapping anonymous memory

- add an fcntl/ioctl that marks a file as skipping dirty background
write, i.e. only write out dirty pages from this file when we find
them in reclaim rather than generally in the background. This makes
them act more like anonymous pages in terms of write-out.

- don't allow these jobs to use real swap

That way you don't need to track swap space at all, assuming you're
tracking disk space usage, memory and I/O - the app gets to do its own
swapping. But I realise this might not work in a general environment.


More information about the Containers mailing list