Skip to contentSkip to conversation

cgroup_fj_common.sh: Do not disable systemd related cgroup subsystems

PATCH In review Ma Xinjian via ltp 2 participants 5 messages Aug 9, 2024 – Aug 21, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cgroup_fj_common.sh: Do not disable systemd related cgroup subsystems

The cpu, io, memory, and pids subsystems under the root cgroup cannot be disabled because they are used for systemd. Currently, the test of cpu and memory subsystems in cgroup_fj_function.sh and cgroup_fj_stress.sh will report the error "echo: write error: device or resource busy".

---
 .../kernel/controllers/cgroup_fj/cgroup_fj_common.sh      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +7 -1
index e866641ba..153d351d7 100755
@@ -77,7 +77,13 @@ common_cleanup()
 
     cgroup_cleanup
 
-    [ "$cgroup_version" = "2" ] && ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control"
+    if [ "$cgroup_version" = "2" ]; then
+        case "$subsystem" in
+        cpu|io|memory|pids)
+            :;;
+        *) ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control";;
+        esac
+    fi
 }
 
 . cgroup_lib.sh
Signature · 5 lines
2.42.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Ma,

Quoted 4 lines

The cpu, io, memory, and pids subsystems under the root cgroup cannot be disabled because they are used for systemd. Currently, the test of cpu and memory subsystems in cgroup_fj_function.sh and cgroup_fj_stress.sh will report the error "echo: write error: device or resource busy".

Could you please share a bit of info on which system it fails. Do you use cgroup v1?

Kind regards,
Petr

Quoted 25 lines
---
 .../kernel/controllers/cgroup_fj/cgroup_fj_common.sh      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +7 -1
index e866641ba..153d351d7 100755
@@ -77,7 +77,13 @@ common_cleanup()
 
     cgroup_cleanup
 
-    [ "$cgroup_version" = "2" ] && ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control"
+    if [ "$cgroup_version" = "2" ]; then
+        case "$subsystem" in
+        cpu|io|memory|pids)
+            :;;
+        *) ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control";;
+        esac
+    fi
 }
 
 . cgroup_lib.sh
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
Quoted 10 lines

Hi Ma,

Quoted 5 lines

The cpu, io, memory, and pids subsystems under the root cgroup cannot be disabled because they are used for systemd. Currently, the test of cpu and memory subsystems in cgroup_fj_function.sh and cgroup_fj_stress.sh will report the error
"echo: write error: device or resource busy".

Could you please share a bit of info on which system it fails. Do you use cgroup v1?

Hi Petr

It fails on Fedora 37 which uses cgroupv2.
cgroupv1 won't trigger this failure.

Quoted 33 lines

Kind regards,
Petr

Quoted 13 lines
---
 .../kernel/controllers/cgroup_fj/cgroup_fj_common.sh      | 8 +++++++-
 1 file changed, 7 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 e866641ba..153d351d7 100755

testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh common_cleanup() · line 80

Quoted 4 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +0 -1
@@ -77,7 +77,13 @@ common_cleanup()
 
     cgroup_cleanup
 
-    [ "$cgroup_version" = "2" ] && ROD echo "-$subsystem" \>

"/sys/fs/cgroup/cgroup.subtree_control"

testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh common_cleanup()

Quoted 5 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +5 -0
+    if [ "$cgroup_version" = "2" ]; then
+        case "$subsystem" in
+        cpu|io|memory|pids)
+            :;;
+        *) ROD echo "-$subsystem" \>

"/sys/fs/cgroup/cgroup.subtree_control";;

Quoted 5 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +2 -0
+        esac
+    fi
 }
 
 . cgroup_lib.sh
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 8 lines
Quoted 7 lines

Hi Ma,

Quoted 5 lines

The cpu, io, memory, and pids subsystems under the root cgroup cannot be disabled because they are used for systemd. Currently, the test of cpu and memory subsystems in cgroup_fj_function.sh and cgroup_fj_stress.sh will report the error
"echo: write error: device or resource busy".

Quoted 7 lines
Quoted 2 lines

Could you please share a bit of info on which system it fails. Do you use cgroup v1?

Hi Petr

It fails on Fedora 37 which uses cgroupv2.
cgroupv1 won't trigger this failure.

OK, thx for info, merged!

I managed to reproduce the same issue also on Debian trixie or some Alpine (which don't use systemd). I still wonder what could be the root cause, because many other systemd based systems have no problem (various SLES versions and openSUSE Tumbleweed).

Kind regards,
Petr

Quoted 32 lines
Quoted 32 lines

Kind regards,
Petr

Quoted 13 lines
---
 .../kernel/controllers/cgroup_fj/cgroup_fj_common.sh      | 8 +++++++-
 1 file changed, 7 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 e866641ba..153d351d7 100755

testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh common_cleanup() · line 80

Quoted 4 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +0 -1
@@ -77,7 +77,13 @@ common_cleanup()
 
     cgroup_cleanup
 
-    [ "$cgroup_version" = "2" ] && ROD echo "-$subsystem" \>

"/sys/fs/cgroup/cgroup.subtree_control"

testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh common_cleanup()

Quoted 5 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +5 -0
+    if [ "$cgroup_version" = "2" ]; then
+        case "$subsystem" in
+        cpu|io|memory|pids)
+            :;;
+        *) ROD echo "-$subsystem" \>

"/sys/fs/cgroup/cgroup.subtree_control";;

Quoted 5 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +2 -0
+        esac
+    fi
 }
 
 . cgroup_lib.sh
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Hi Ma,

...

Quoted 1 line

OK, thx for info, merged!

I'm sorry, I by accident merged v1 instead of v2. Therefore I merged code from v2 under your name.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp