[lxc-users] LXC reports memory usage as 0
Dwight Engen
dwight.engen at oracle.com
Tue Jan 7 22:06:31 UTC 2014
On Tue, 7 Jan 2014 13:44:36 -0800
Allan Caffee <allan.caffee at gmail.com> wrote:
> I'm trying to use lxc to limit the memory that can be consumed by a
> process, but when I run something with a container all of the
> resource usage statistics
> report back as 0.
>
> I'm using the following config for my container:
>
> lxc.cgroup.memory.soft_limit_in_bytes = 512M
> lxc.cgroup.memory.limit_in_bytes = 512M
> lxc.cgroup.memory.memsw.limit_in_bytes = 1G
>
> And when I create the container and start an app inside of it I can
> see that the limits are reflected by the container, but the current
> values always report as 0:
>
> $
> head /cgroup/lxc/large-app/memory.{limit_in_bytes,usage_in_bytes}
> ==> /cgroup/lxc/large-app/memory.limit_in_bytes <== 536870912
>
> ==> /cgroup/lxc/large-app/memory.usage_in_bytes <==
> 0
>
> When I look up one directory in "/cgroup/lxc" the usage also appears
> to be 0, but
> when I go all the way to the top level "/cgroup" directory I get
> stats that seem
> to accurately reflect the system stats as a whole.
Maybe check /cgroup/memory/memory.use_hierarchy? I've seen where that
isn't set to 1 and thus lxc can set it to 1 at lower tree levels.
> I'm running RHEL 6.1 and lxc version 0.9.0. And the system appears to
> be configured to support cgroups:
>
> $ lxc-checkconfig
> Kernel configuration not found at /proc/config.gz; searching...
> Kernel configuration found
> at /boot/config-2.6.32-131.4.1.el6.x86_64 --- Namespaces ---
> Namespaces: enabled
> Utsname namespace: enabled
> Ipc namespace: enabled
> Pid namespace: enabled
> User namespace: enabled
> Network namespace: enabled
> Multiple /dev/pts instances: enabled
>
> --- Control groups ---
> Cgroup: enabled
> Cgroup namespace: enabled
> Cgroup device: enabled
> Cgroup sched: enabled
> Cgroup cpu account: enabled
> Cgroup memory controller: enabled
> Cgroup cpuset: enabled
>
> --- Misc ---
> Veth pair device: enabled
> Macvlan: enabled
> Vlan: enabled
> File capabilities: enabled
>
> Note : Before booting a new kernel, you can check its
> configuration usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig
>
> Thanks in advance for any help you can provide.
>
> --
> Allan
More information about the lxc-users
mailing list