diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2021-02-23 23:08:56 -0600 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2021-02-23 23:08:56 -0600 |
commit | 4fb4674374931be2fa279692800185078f350d9f (patch) | |
tree | c20f81512c50856814d753a02db216ee2c06c525 /init.d/cgroups.in | |
parent | 0ddab761be249f54388c12f6cc8197dd01a63673 (diff) |
fix unified cgroups v2 setup
The cgroups v2 setup required the rc_cgroups_controllers variable
to be set to the list of controllers to enable regardless of whether the
mode was hybrid or unified.
This makes sense for hybrid mode since the controllers can't be in both
the cgroups v1 and v2 hierarchies, but for unified mode we should enable
all controllers that are configured in the kernel.
Diffstat (limited to 'init.d/cgroups.in')
-rw-r--r-- | init.d/cgroups.in | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/init.d/cgroups.in b/init.d/cgroups.in index 3d5bfa7b..c5399e37 100644 --- a/init.d/cgroups.in +++ b/init.d/cgroups.in @@ -83,14 +83,22 @@ cgroup2_controllers() local active cgroup_path x y cgroup_path="$(cgroup2_find_path)" [ -z "${cgroup_path}" ] && return 0 - [ -e "${cgroup_path}/cgroup.controllers" ] && + [ ! -e "${cgroup_path}/cgroup.controllers" ] && return 0 + [ ! -e "${cgroup_path}/cgroup.subtree_control" ]&& return 0 read -r active < "${cgroup_path}/cgroup.controllers" - for x in ${rc_cgroup_controllers}; do - for y in ${active}; do - [ "$x" = "$y" ] && - [ -e "${cgroup_path}/cgroup.subtree_control" ]&& + for x in ${active}; do + case "$rc_cgroup_mode" in + unified) echo "+${x}" > "${cgroup_path}/cgroup.subtree_control" - done + ;; + hybrid) + for y in ${rc_cgroup_controllers}; do + if [ "$x" = "$y" ]; then + echo "+${x}" > "${cgroup_path}/cgroup.subtree_control" + fi + done + ;; + esac done return 0 } |