CPU limits for CGroups are unavailable on Ubuntu 16 OVH server

Created:

2017-03-28 12:55:47 UTC

Modified:

2017-08-08 13:45:47 UTC

0

Was this article helpful?


Have more questions?

Submit a request

CPU limits for CGroups are unavailable on Ubuntu 16 OVH server

Symptoms

CPU limits for CGroups are unavailable on Ubuntu 16 OVH server in Plesk interface. The following features are listed on a server:

# plesk sbin resctrl --features
{"cpu": false, "cpuacct": true, "memory": true, "blkio": true, "vhosts_blkio": true}

Cause

Kernel needs to be additionally compiled

Resolution

As in Plesk there are 4 cgroups controllers used: CPU, CPUACCT, MEMORY and BLK, Linux kernel on a Ubuntu server must be compiled with certain parameters that are listed below.

1. To enable CPU cgroup:

CONFIG_FAIR_GROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y

2. To enable CPUACCT cgroup:

CONFIG_CGROUP_CPUACCT=y

3. To enable MEMORY cgroup:

for kernels 2.6.25–2.6.39, 3.0–3.5:

CONFIG_CGROUP_MEM_RES_CTLR=y
CONFIG_CGROUP_MEM_RES_CTLR_DISABLED=y
CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y
# CONFIG_CGROUP_MEM_RES_CTLR_SWAP_ENABLED is not set

if "CONFIG_CGROUP_MEM_RES_CTLR_DISABLED=y" and "CONFIG_CGROUP_MEM_RES_CTLR_SWAP_ENABLED" is not set then linux kernel must be booted with "cgroup_enable=memory swapaccount=1".

To do this edit /etc/default/grub file by setting:

GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

then run:

update-grub && reboot

# cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-2.6.32-5-openvz-amd64 root=UUID=xxxx ro cgroup_enable=memory swapaccount=1 quiet console=ttyS0,57600n8

Note: replace UUID=xxxx with correct UUID.

for kernels 3.6–3.19, 4.0–4.x:

CONFIG_MEMCG=y
CONFIG_MEMCG_SWAP=y
# CONFIG_MEMCG_SWAP_ENABLED is not set
CONFIG_MEMCG_KMEM=y

4. To enable BLK cgroup:

CONFIG_BLK_CGROUP=y
Have more questions? Submit a request
Please sign in to leave a comment.