<div dir="ltr"><div>I'm trying to use lxc to limit the memory that can be consumed by a process,<br>but when I run something with a container all of the resource usage statistics<br>report back as 0.<br><br>I'm using the following config for my container:<br>
<br> lxc.cgroup.memory.soft_limit_in_bytes = 512M<br> lxc.cgroup.memory.limit_in_bytes = 512M<br> lxc.cgroup.memory.memsw.limit_in_bytes = 1G<br><br>And when I create the container and start an app inside of it I can see that<br>
the limits are reflected by the container, but the current values always<br>report as 0:<br><br> $ head /cgroup/lxc/large-app/memory.{limit_in_bytes,usage_in_bytes}<br> ==> /cgroup/lxc/large-app/memory.limit_in_bytes <==<br>
536870912<br><br> ==> /cgroup/lxc/large-app/memory.usage_in_bytes <==<br> 0<br><br></div>When I look up one directory in "/cgroup/lxc" the usage also appears to be 0, but<br>when I go all the way to the top level "/cgroup" directory I get stats that seem<br>
to accurately reflect the system stats as a whole.<br><div><br>I'm running RHEL 6.1 and lxc version 0.9.0. And the system appears to be<br>configured to support cgroups:<br><br> $ lxc-checkconfig<br> Kernel configuration not found at /proc/config.gz; searching...<br>
Kernel configuration found at /boot/config-2.6.32-131.4.1.el6.x86_64<br> --- Namespaces ---<br> Namespaces: enabled<br> Utsname namespace: enabled<br> Ipc namespace: enabled<br> Pid namespace: enabled<br>
User namespace: enabled<br> Network namespace: enabled<br> Multiple /dev/pts instances: enabled<br><br> --- Control groups ---<br> Cgroup: enabled<br> Cgroup namespace: enabled<br> Cgroup device: enabled<br>
Cgroup sched: enabled<br> Cgroup cpu account: enabled<br> Cgroup memory controller: enabled<br> Cgroup cpuset: enabled<br><br> --- Misc ---<br> Veth pair device: enabled<br> Macvlan: enabled<br> Vlan: enabled<br>
File capabilities: enabled<br><br> Note : Before booting a new kernel, you can check its configuration<br> usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig<br><br></div><div>Thanks in advance for any help you can provide.<br>
<br>--<br></div><div>Allan<br></div><div><br></div></div>