Required to activate cgroups in Linux

cgrouplinux-kernellxc

I have a Debian squeeze kernel (linux-image-2.6.32-5-openvz-amd64) which according to the Doku should support cgroups. When I look into the kernel configuration, it does (or is some other kernel configuration required?)

# zgrep -i cgroup /boot/config-2.6.32-5-openvz-amd64
# CONFIG_CGROUP_SCHED is not set
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_DEVICE=y
CONFIG_BLK_CGROUP=y
# CONFIG_DEBUG_BLK_CGROUP is not set
CONFIG_NET_CLS_CGROUP=y

Also, according to http://wiki.debian.org/LXC, a kernel parameter cgroup_enable=memory might be necessary. I started the kernel with it:

# cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-2.6.32-5-openvz-amd64 root=UUID=6332fe39-7eaa-4519-b6c1-e05808284586 ro cgroup_enable=memory quiet console=ttyS0,57600n8

However, the system still has no cgroup support! The cgroup file system cannot be mounted as the file system type is not even known to the system:

# mount -t cgroup none /cgroup
mount: unknown filesystem type 'cgroup'

and:

# grep -i cgroup /proc/filesystems
#

So there is either a bug or I miss something. Can anyone tell me what?
Is there a kernel parameter missing?
A kernel configuration?

Best Answer

You have to pass an -o to tell it what to mount.

mount -t cgroup -o memory cgroup_memory /sys/fs/cgroup/memory

And that's assuming that /sys/fs/cgroup is mounted at all.

mount -t tmpfs cgroup /sys/fs/cgroup

Ubuntu has a package named cgroup-lite which can do all this at boot. It doesn't appear to be in Debian so I'm not sure what the equivalent might be.

Note: I cannot add comments so I have to simply answer your question this way. For example: I wanted to ask if you had checked your kernel logs (dmesg | grep cgroup).

Related Topic