cgroup_fj: don't disable controller that was already enabled
PATCH 1/1 cgroup_fj: don't disable controller that was already enabled
From: Andrea Cervesato <[email protected]>
On immutable distributions (and systemd-managed systems in general) the cpuset controller is typically already enabled at the root cgroup level. The cleanup tried to unconditionally disable it via subtree_control, which failed with EBUSY because other system cgroups were still using it, producing a spurious TWARN.
Save whether the controller was already enabled at root before cgroup_require and skip the root-level disable in cleanup when it was.
--- testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +9 -1
@@ -57,6 +57,14 @@ create_subgroup() common_setup() { + # Check if the controller is already enabled at root before + # cgroup_require potentially enables it, so that cleanup does + # not disable a controller the system was already using. + if [ -f /sys/fs/cgroup/cgroup.subtree_control ] && \ + grep -qw "$subsystem" /sys/fs/cgroup/cgroup.subtree_control; then + ctrl_was_enabled=1 + fi + cgroup_require "$subsystem" mount_point=$(cgroup_get_mountpoint "$subsystem") start_path=$(cgroup_get_test_path "$subsystem")
@@ -77,7 +85,7 @@ common_cleanup() cgroup_cleanup - if [ "$cgroup_version" = "2" ]; then + if [ "$cgroup_version" = "2" ] && [ "$ctrl_was_enabled" != "1" ]; then case "$subsystem" in cpu|io|memory|pids) :;;
---
base-commit: a375e8deed471723f5a0114c56eb48fe6f6f45d3
change-id: 20260611-fix_cgroup_immutable-2259f7591f8d
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Andrea,
Quoted 1 line · Andrea Cervesato
cgroup_fj: don't disable controller that was already enabled
Verdict: Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 50 lines · Andrea Cervesato
From: Andrea Cervesato <[email protected]>
On immutable distributions (and systemd-managed systems in general) the cpuset controller is typically already enabled at the root cgroup level. The cleanup tried to unconditionally disable it via
subtree_control, which failed with EBUSY because other system cgroups were still using it, producing a spurious TWARN.Save whether the controller was already enabled at root before
cgroup_requireand skip the root-level disable in cleanup when it was.Signed-off-by Andrea Cervesato <[email protected]>--- testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +9
-2@@ -57,6 +57,14 @@ create_subgroup() common_setup() { + # Check if the controller is already enabled at root before + # cgroup_require potentially enables it, so that cleanup does + # not disable a controller the system was already using. + if [ -f /sys/fs/cgroup/cgroup.subtree_control ] && \ + grep -qw "$subsystem" /sys/fs/cgroup/cgroup.subtree_control; then + ctrl_was_enabled=1 + fi + cgroup_require "$subsystem" mount_point=$(cgroup_get_mountpoint "$subsystem") start_path=$(cgroup_get_test_path "$subsystem")@@ -77,7 +85,7 @@ common_cleanup() cgroup_cleanup - if [ "$cgroup_version" = "2" ]; then + if [ "$cgroup_version" = "2" ] && [ "$ctrl_was_enabled" != "1" ]; then case "$subsystem" in cpu|io|memory|pids) :;; ---base-commit:
a375e8deed471723f5a0114c56eb48fe6f6f45d3
change-id: 20260611-fix_cgroup_immutable-2259f7591f8d
Quoted 3 lines
Best regards,
Signature · 1 line
Andrea Cervesato <[email protected]>
Quoted 4 lines
Signature · 2 lines
-- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Sebastian Chlad
Reviewed-byQuoted 52 lines · Wei Gao via ltp
Quoted 8 lines · Andrea Cervesato
From: Andrea Cervesato <[email protected]>
On immutable distributions (and systemd-managed systems in general) the cpuset controller is typically already enabled at the root cgroup level. The cleanup tried to unconditionally disable it via
subtree_control, which failed with EBUSY because other system cgroups were still using it, producing a spurious TWARN.Quoted 7 lines
Save whether the controller was already enabled at root before
cgroup_requireand skip the root-level disable in cleanup when it was.Signed-off-by Andrea Cervesato <[email protected]>--- testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 10+++++++++-
Review
Quoted 3 lines
1 file changed, 9 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.shQuoted 1 line
index
153d351d7936effb15527620f565acaaed7ac747..8b5e73466ba32d2c66a2805a03f4d2136c16509b100755Quoted 18 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +8
-0@@ -57,6 +57,14 @@ create_subgroup() common_setup() { + # Check if the controller is already enabled at root before + # cgroup_require potentially enables it, so that cleanup does + # not disable a controller the system was already using. + if [ -f /sys/fs/cgroup/cgroup.subtree_control ] && \ + grep -qw "$subsystem" /sys/fs/cgroup/cgroup.subtree_control; then + ctrl_was_enabled=1 + fi + cgroup_require "$subsystem" mount_point=$(cgroup_get_mountpoint "$subsystem") start_path=$(cgroup_get_test_path "$subsystem")testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh common_cleanup() · line 88
Quoted 5 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +1
-1@@ -77,7 +85,7 @@ common_cleanup() cgroup_cleanup - if [ "$cgroup_version" = "2" ]; then + if [ "$cgroup_version" = "2" ] && [ "$ctrl_was_enabled" != "1" ];then
Quoted 4 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +0
-0case "$subsystem" in cpu|io|memory|pids) :;;
Quoted 9 lines
Quoted 7 lines
---
base-commit:a375e8deed471723f5a0114c56eb48fe6f6f45d3
change-id: 20260611-fix_cgroup_immutable-2259f7591f8dBest regards,
--
Andrea Cervesato <[email protected]>Reviewed-by Wei Gao <[email protected]>
Feel free to add:
Quoted 8 lines
Quoted 4 lines
--
Mailing list info: https://lists.linux.it/listinfo/ltp--
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedMerged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp