2 # SPDX-License-Identifier: GPL-2.0
4 # Kselftest framework requirement - SKIP code is 4.
19 echo $verb$subsys_ctrl >$sysfs/cgroup.subtree_control
20 [ $verb = "+" ] && verb
=- || verb
=+
21 # incommensurable period with other stresses
28 sysfs
=`mount -t cgroup2 | head -1 | awk '{ print $3 }'`
29 if [ ! -d "$sysfs" ]; then
30 echo "Skipping: cgroup2 is not mounted" >&2
34 if ! echo +$subsys_ctrl >$sysfs/cgroup.subtree_control
; then
35 echo "Skipping: cannot enable $subsys_ctrl in $sysfs" >&2
39 if ! echo -$subsys_ctrl >$sysfs/cgroup.subtree_control
; then
40 echo "Skipping: cannot disable $subsys_ctrl in $sysfs" >&2
46 declare -a stress_pids
52 while getopts c
:d
:hs
: opt
; do
61 echo "Usage $0 [ -s stress ] ... [ -d duration ] [-c controller] cmd args .."
62 echo -e "\t default duration $duration seconds"
63 echo -e "\t default controller $subsys_ctrl"
68 if [ "x$(type -t $func)" != "xfunction" ] ; then
69 echo "Unknown stress $OPTARG"
80 for s
in ${stresses[*]} ; do
89 while [ $time -lt $duration ] ; do
92 [ $rc -eq 0 ] ||
break
93 time=$
(($
(date +%s
) - $start))
96 for pid
in ${stress_pids[*]} ; do