From 6483da955aa9d6054f94bc5df229bcb69f870d67 Mon Sep 17 00:00:00 2001 From: Maria Shaldybin Date: Mon, 18 Nov 2024 21:53:44 +0000 Subject: [PATCH] Setup cgroups v2 controllers inside docker container --- scripts/docker/test.bash | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/docker/test.bash b/scripts/docker/test.bash index 073e02d25..9a3dd1059 100755 --- a/scripts/docker/test.bash +++ b/scripts/docker/test.bash @@ -3,6 +3,17 @@ set -eu set -o pipefail +if [ -f /sys/fs/cgroup/cgroup.controllers ]; then + echo "Setting up controllers for cgroup v2" + # move the processes from the root group to the /init group, + # otherwise writing subtree_control fails with EBUSY + # An error during moving non-existent process (i.e., "cat") is ignored. + mkdir -p /sys/fs/cgroup/init + xargs -rn1 < /sys/fs/cgroup/cgroup.procs > /sys/fs/cgroup/init/cgroup.procs || : + # enable controllers + sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers > /sys/fs/cgroup/cgroup.subtree_control +fi + . "/ci/shared/helpers/git-helpers.bash" function test() {