[lxc-users] memory.memsw.limit_in_bytes not working on ubuntu 14.04?

Serge Hallyn serge.hallyn at ubuntu.com
Thu Feb 6 18:11:23 UTC 2014


Quoting Flo (florian.engelmann at gmail.com):
> Hi,
> 
> On Tue, Feb 4, 2014 at 10:20 PM, Florian Engelmann <engelmann at d-g-c.de>wrote:
> 
> > Hi,
> >
> > adding "swapaccount=1" to my kernel cmdline fixed that.
> >
> >
> This fixed "lxc.cgroup.memory.memsw.limit_in_bytes" but I was not able to
> set
> 
> lxc.cgroup.memory.swappiness = 10
> 
> and
> 
> lxc.cgroup.memory.oom_control = 0
> 
> Why?

This is confirmed by both mm/memcontrol.c, which says:

/* If under hierarchy, only empty-root can set this value */
if ((parent->use_hierarchy) ||
		memcg_has_children(memcg)) {
	mutex_unlock(&memcg_create_mutex);
	return -EINVAL;
}

and Documentation/cgroups/memory.txt which says:

Following cgroups' swappiness can't be changed.
- root cgroup (uses /proc/sys/vm/swappiness).
- a cgroup which uses hierarchy and it has other cgroup(s) below it.
- a cgroup which uses hierarchy and not the root of hierarchy.

So basically in order to be able to use this, you would have to either
run with use_heirarchy off, or make sure that you set use_hierarchy
to 0 for /lxc and set it to 1 for each container individually.

The latter might be the sanest way to run anyway...  But I'm pretty
sure that right now lxc won't let you.  We may want to fix that.

-serge


More information about the lxc-users mailing list