All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] cgroup_fj: don't disable controller that was already enabled
@ 2026-06-11 15:03 Andrea Cervesato
  2026-06-11 18:17 ` [LTP] " linuxtestproject.agent
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrea Cervesato @ 2026-06-11 15:03 UTC (permalink / raw)
  To: Linux Test Project

From: Andrea Cervesato <andrea.cervesato@suse.com>

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.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
index 153d351d7936effb15527620f565acaaed7ac747..8b5e73466ba32d2c66a2805a03f4d2136c16509b 100755
--- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
+++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
@@ -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,
-- 
Andrea Cervesato <andrea.cervesato@suse.com>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-12  9:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11 15:03 [LTP] [PATCH] cgroup_fj: don't disable controller that was already enabled Andrea Cervesato
2026-06-11 18:17 ` [LTP] " linuxtestproject.agent
2026-06-12  9:04 ` [LTP] [PATCH] " Wei Gao via ltp
2026-06-12  9:18   ` Sebastian Chlad
2026-06-12  9:40 ` Andrea Cervesato via ltp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.