memrlimit controller merge to mainline

KAMEZAWA Hiroyuki kamezawa.hiroyu at
Tue Jul 29 18:17:19 PDT 2008

On Wed, 30 Jul 2008 01:16:17 +0100 (BST)
Hugh Dickins <hugh at> wrote:

> On Tue, 29 Jul 2008, KAMEZAWA Hiroyuki wrote:
> > On Fri, 25 Jul 2008 17:46:45 +0100 (BST)
> > Hugh Dickins <hugh at> wrote:
> > 
> > > IIRC Rik expressed the same by pointing out that a cgroup at its
> > > swap limit would then be forced to grow in mem (until it hits its
> > > mem limit): so controlling the less precious resource would increase
> > > pressure on the more precious resource.  (Actually, that probably
> > > bears little relation to what he said - sorry, Rik!)  I don't recall
> > > what answer he got, perhaps I'd be persuaded if I heard it again.
> > > 
> > Added Nishimura to CC.
> > 
> > IMHO, from user point of view, both of
> >  - having 2 controls as mem controller + swap controller
> >  - mem + swap controller
> > doesn't have much difference. The users will use as they like.
> I'm not suggesting either one of those alternatives.
> I'm suggesting we have a mem controller (the thing we already have)
> and a mem+swap controller (which we don't yet have: a controller
> for the total mem+swap of a cgroup); the mem+swap controller likely
> making use of much that is in the mem controller, as Paul has said.
Ah, what mem+swap controller means is limitiing mem+swap by 'a' limit ?
It's a choice for me. From view of global LRU management, it's better.
If we can avoid an accident that the swap is fully used by some silly program,
anything is ok to me.

How about you, Nishimura-san ?

A story I talked is based on the assumption that there may be not enough swap
space against memory. We can ask cutomers to equip tons of swap when 
memory is huge. BTW, what is the maximum swap size now ?
Can we extend it if it's small ?

> > state 4) Run a big program on B.
> >   A...memory_usage=500M swap_usage=700M.
> >   B...memory_usage=1G   swap_usage=300M
> If you believe a swap controller would make that better, what limits
> do you suggest?  If you assign A a swap limit of 700M or above, it
> changes nothing; if you assign A a swap limit below 700M, it cannot
> do all the work that it could do in the example.

Of course, set A's swap_limit of 300M and get swap pages into memory and
free swap entries and make A on memory. (before B starts.)

> > But users think why A uses 700M of swap with 500M of free memory....
> Because at this time A isn't actively using any of that 700M.

That's a weakness of "do all by automatic detection and ideal algoritm".
It's just a result of LRU algorithm, which is not always the users think


More information about the Containers mailing list