[lxc-users] LXC reports memory usage as 0

Allan Caffee allan.caffee at gmail.com
Tue Jan 7 21:44:36 UTC 2014


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.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140107/d4b654f2/attachment.html>


More information about the lxc-users mailing list