[lxc-users] memory.limit_in_bytes works, but not memory.memsw.limit_in_bytes and cpuset.cpus

Serge Hallyn serge.hallyn at ubuntu.com
Wed Apr 29 13:15:03 UTC 2015


Quoting Yonsy Solis (yonsy.s.p at gmail.com):
> 
> 
> On Wed, Apr 29, 2015 at 7:10 AM, Jäkel, Guido <G.Jaekel at dnb.de> wrote:
> >Dear Yonsys,
> >
> >this is a known bug/feature of the controller, You can't
> >
> >* lower  memory.memsw limit_in_bytes  below  memory.limit_in_bytes
> >* raise memory.limit_in_bytes above memory.memsw limit_in_bytes
> >
> >Notice that the default is "infinite" (max integer). For the
> >typical usecase to lower the limits once at start, you have to
> >lower memory.limit_in_bytes first. But if you want to raise the
> >limits afterwards, you have to rise memory.memsw limit_in_bytes
> >first
> 
> heh, i did learn this before by "experience" (error messages when i
> set up in another order), but thanks.
> 
> but in my host, i can limit memory.limit_in_bytes but, for example
> 
> lxc-start -n db09
> lxc-cgroup -n db09 memory.limit_in_bytes 512M
> lxc-cgroup -n db09 memory.memsw.limit_in_bytes 2G
> 
> the host have 8GB RAM and 4GB swap.
> 
> with htop (and top too) i can see my ram memory in the container
> limited to 512MB but the swap memory continue to be 4GB on this, not
> 2GB. In any case is not critical because i like the idea to use swap
> memory minimal in the containers (and the host too)

Wait are you saying the swap limit reported by htop is wrong?  That
presumably is just a lxcfs shortcoming.  Does htop get that from
/proc/swaps?


More information about the lxc-users mailing list