cgroup_fj_common.sh: Do not disable systemd related cgroup subsystems
PATCH 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".
--- testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +4 -1
@@ -77,7 +77,10 @@ common_cleanup() cgroup_cleanup - [ "$cgroup_version" = "2" ] && ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control" + if [ "$cgroup_version" = "2" ] && [ "$subsystem" != "cpu" ] && [ "$subsystem" != "io" ] \ + && [ "$subsystem" != "memory" ] && [ "$subsystem" != "pids" ]; then + ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control" + fi } . cgroup_lib.sh
Signature · 5 lines
2.42.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
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.shandcgroup_fj_stress.shwill report the error "echo: write error: device or resource busy".
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh common_cleanup() · line 83
Quoted 5 lines
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +4
-1- [ "$cgroup_version" = "2" ] && ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control" + if [ "$cgroup_version" = "2" ] && [ "$subsystem" != "cpu" ] && [ "$subsystem" != "io" ] \ + && [ "$subsystem" != "memory" ] && [ "$subsystem" != "pids" ]; then + ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control" + fi
I would personally wrote it as:
if [ "$cgroup_version" = "2" ]; then
case "$subsystem" in
cpu|io|memory|pid)
:;;
*) ROD echo "-$subsystem" \> "/sys/fs/cgroup/cgroup.subtree_control";;
esac
fiKind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 22 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.shandcgroup_fj_stress.shwill report the error
"echo: write error: device or resource busy".Reviewed-by Petr Vorel <[email protected]>Quoted 1 line
- [ "$cgroup_version" = "2" ] && ROD echo "-$subsystem" \>
"
/sys/fs/cgroup/cgroup.subtree_control"Quoted 1 line
+ if [ "$cgroup_version" = "2" ] && [ "$subsystem" != "cpu" ] &&
[ "$subsystem" != "io" ] \
Quoted 1 line
+ && [ "$subsystem" != "memory" ] && [ "$subsystem" !=
"pids" ]; then
Quoted 1 line
+ ROD echo "-$subsystem" \>
"
/sys/fs/cgroup/cgroup.subtree_control"Quoted 1 line
+ fi
I would personally wrote it as:
Quoted 8 lines
if [ "$cgroup_version" = "2" ]; then case "$subsystem" in cpu|io|memory|pid) :;; *) ROD echo "-$subsystem" \>"
/sys/fs/cgroup/cgroup.subtree_control";;
esac
fi
Hi Petr
Thanks for the code optimization. It looks much simpler. I have submitted [PATCH v2], PTAL.
Best regards,
Ma
Quoted 3 lines
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp