[LTP] [PATCH] cgroup_fj_common.sh: Do not disable systemd related cgroup subsystems

Petr Vorel pvorel@suse.cz
Thu Aug 8 11:32:25 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

Kind regards,
Petr


More information about the ltp mailing list