[LTP] [PATCH] cgroup_fj_common.sh: Do not disable systemd related cgroup subsystems
Xinjian Ma (Fujitsu)
maxj.fnst@fujitsu.com
Fri Aug 9 09:35:59 CEST 2024
> Hi Ma,
>
> > 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".
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> > - [ "$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
> fi
Hi Petr
Thanks for the code optimization. It looks much simpler.
I have submitted [PATCH v2], PTAL.
Best regards,
Ma
>
> Kind regards,
> Petr
More information about the ltp
mailing list