All Products
Search
Document Center

Alibaba Cloud Linux:How to switch to cgroup v1 in Alibaba Cloud Linux 4

Last Updated:Sep 03, 2025

Alibaba Cloud Linux 4 enables cgroup v2 by default, but also supports switching to cgroup v1. This topic describes how to confirm the current cgroup version and how to switch.

Note

cgroup v1 and cgroup v2 are the two main versions of the cgroup mechanism. They have significant differences in their design and usage. For more information, see Differences between cgroup v1 and cgroup v2.

Applicable operating system

Alibaba Cloud Linux 4

Procedure

  1. Check the current cgroup version.

    mount | grep cgroup

    If the output contains cgroup2, it indicates that cgroup v2 is enabled on the system.

    cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
  2. Add the systemd.unified_cgroup_hierarchy=0 and systemd.legacy_systemd_cgroup_controller parameters to the kernel.

    grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="systemd.unified_cgroup_hierarchy=0 systemd.legacy_systemd_cgroup_controller"
  3. Restart the system for the changes to take effect.

    reboot
  4. Check the cgroup version again.

    mount | grep cgroup

    The following output indicates that cgroup v1 is enabled on the system.

    tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755)
    cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
    cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
    cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
    cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
    cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
    cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
    cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
    cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
    cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
    cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
    cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
    cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)