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.
This commit is contained in:
parent
0ddab761be
commit
4fb4674374
@ -198,10 +198,9 @@ rc_tty_number=12
|
|||||||
# "unified" mounts cgroups version 2 on /sys/fs/cgroup
|
# "unified" mounts cgroups version 2 on /sys/fs/cgroup
|
||||||
#rc_cgroup_mode="hybrid"
|
#rc_cgroup_mode="hybrid"
|
||||||
|
|
||||||
# This is a list of controllers which should be enabled for cgroups version 2.
|
# This is a list of controllers which should be enabled for cgroups version 2
|
||||||
# If hybrid mode is being used, controllers listed here will not be
|
# when hybrid mode is being used.
|
||||||
# available for cgroups version 1.
|
# Controllers listed here will not be available for cgroups version 1.
|
||||||
# This is a global setting.
|
|
||||||
#rc_cgroup_controllers=""
|
#rc_cgroup_controllers=""
|
||||||
|
|
||||||
# This variable contains the cgroups version 2 settings for your services.
|
# This variable contains the cgroups version 2 settings for your services.
|
||||||
|
@ -83,14 +83,22 @@ cgroup2_controllers()
|
|||||||
local active cgroup_path x y
|
local active cgroup_path x y
|
||||||
cgroup_path="$(cgroup2_find_path)"
|
cgroup_path="$(cgroup2_find_path)"
|
||||||
[ -z "${cgroup_path}" ] && return 0
|
[ -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"
|
read -r active < "${cgroup_path}/cgroup.controllers"
|
||||||
for x in ${rc_cgroup_controllers}; do
|
for x in ${active}; do
|
||||||
for y in ${active}; do
|
case "$rc_cgroup_mode" in
|
||||||
[ "$x" = "$y" ] &&
|
unified)
|
||||||
[ -e "${cgroup_path}/cgroup.subtree_control" ]&&
|
|
||||||
echo "+${x}" > "${cgroup_path}/cgroup.subtree_control"
|
echo "+${x}" > "${cgroup_path}/cgroup.subtree_control"
|
||||||
|
;;
|
||||||
|
hybrid)
|
||||||
|
for y in ${rc_cgroup_controllers}; do
|
||||||
|
if [ "$x" = "$y" ]; then
|
||||||
|
echo "+${x}" > "${cgroup_path}/cgroup.subtree_control"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user