[lxc-users] Centos-7 x86_64 container not limit memory inside and show cgroups from node

mxs kolo kolomaxes at gmail.com
Tue Jul 29 16:02:51 UTC 2014


HI all

I create centos-7 container with lxc-centos template:
#lxc-create  -t centos  -n ce7-2  -B lvm --lvname=ce7-2  --vgname=data
--fstype=xfs --fssize=10G  -- --release 7  --arch x86_64

After start, in container showed /sys/fs/cgroups from hardware node:
[root at ce7-2 /]# find  /sys/fs/cgroup/ -type d -name lxc
/sys/fs/cgroup/hugetlb/lxc
/sys/fs/cgroup/perf_event/lxc
/sys/fs/cgroup/blkio/lxc
/sys/fs/cgroup/net_cls/lxc
/sys/fs/cgroup/freezer/lxc
/sys/fs/cgroup/devices/lxc
/sys/fs/cgroup/memory/lxc
/sys/fs/cgroup/cpu,cpuacct/lxc
/sys/fs/cgroup/cpuset/lxc

[root at ce7-2 /]# ls -la /sys/fs/cgroup/memory/lxc/
total 0
drwxr-xr-x 13 root root 0 Jul 29 19:06 .
drwxr-xr-x  3 root root 0 Jul 29 12:06 ..
drwxr-xr-x  2 root root 0 Jul 29 19:34 ce7-2
-rw-r--r--  1 root root 0 Jul 29 12:07 cgroup.clone_children
--w--w--w-  1 root root 0 Jul 29 12:07 cgroup.event_control
-rw-r--r--  1 root root 0 Jul 29 12:07 cgroup.procs
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.failcnt
--w-------  1 root root 0 Jul 29 12:07 memory.force_empty
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.kmem.failcnt
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.kmem.limit_in_bytes
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.kmem.max_usage_in_bytes
-r--r--r--  1 root root 0 Jul 29 12:07 memory.kmem.slabinfo
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.kmem.tcp.failcnt
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.kmem.tcp.limit_in_bytes
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.kmem.tcp.max_usage_in_bytes
-r--r--r--  1 root root 0 Jul 29 12:07 memory.kmem.tcp.usage_in_bytes
-r--r--r--  1 root root 0 Jul 29 12:07 memory.kmem.usage_in_bytes
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.limit_in_bytes
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.max_usage_in_bytes
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.memsw.failcnt
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.memsw.limit_in_bytes
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.memsw.max_usage_in_bytes
-r--r--r--  1 root root 0 Jul 29 12:07 memory.memsw.usage_in_bytes
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.move_charge_at_immigrate
-r--r--r--  1 root root 0 Jul 29 12:07 memory.numa_stat
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.oom_control
----------  1 root root 0 Jul 29 12:07 memory.pressure_level
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.soft_limit_in_bytes
-r--r--r--  1 root root 0 Jul 29 12:07 memory.stat
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.swappiness
-r--r--r--  1 root root 0 Jul 29 12:07 memory.usage_in_bytes
-rw-r--r--  1 root root 0 Jul 29 12:07 memory.use_hierarchy
drwxr-xr-x  2 root root 0 Jul 29 12:07 mongo01
drwxr-xr-x  2 root root 0 Jul 29 12:07 mongo02
drwxr-xr-x  2 root root 0 Jul 29 12:07 mongo03
drwxr-xr-x  2 root root 0 Jul 29 12:07 mongo04
drwxr-xr-x  2 root root 0 Jul 29 12:07 mongo05
-rw-r--r--  1 root root 0 Jul 29 12:07 notify_on_release
-rw-r--r--  1 root root 0 Jul 29 12:07 tasks

mongo0[1234] - it's  name of another running containers on this hardware node.
And memory limit not applied for this container.
Limit set as:
# grep mem  /var/lib/lxc/ce7-2/config
lxc.cgroup.memory.limit_in_bytes=2G
lxc.cgroup.memory.memsw.limit_in_bytes=2G

But in container according cgroup from HW node:
[root at ce7-2 /]# cat /sys/fs/cgroup/memory/memory.limit_in_bytes
9223372036854775807
[root at ce7-2 /]# cat /sys/fs/cgroup/memory/lxc/memory.limit_in_bytes
9223372036854775807
[root at ce7-2 /]# cat /sys/fs/cgroup/memory/lxc/ce7-2/memory.limit_in_bytes
2147483648

How mount correct /sys/fs/cgroup  inside container and limit memory ?

p.s.
 I test centos-6 and memory limit work on it. On ce-7 I can use all HW
node memory.

b.r.
 Maxim Kozin


More information about the lxc-users mailing list