[LTP] [PATCH] controllers/cpuset: default cpuset.sched_load_balance to 1

Petr Vorel pvorel@suse.cz
Mon Jun 13 17:08:44 CEST 2022


Hi Hongchen,

> when we exited between the cpuset test,we may leave /dev/cpuset
> not cleared. And we did the cpuset test again, we would set the
> cpuset.sched_load_balance to 0 as following:
> 	setup()
>         if [ -e "$CPUSET" ]
>         cleanup
> 	echo $SCHED_LB_VALUE > $SCHED_LB
> as the default value of cpuset.sched_load_balance is 1 at the time
> cpuset mounted, so it is reasonably to be set to 1.

It makes sense to use the default value (1), but how about setting values only
when really get? That'd be IMHO the safest way. WDYT?

-CHILDREN_VALUE="0"
+CHILDREN_VALUE=
 HOTPLUG_CPU="1"
 SCHED_LB="/dev/cpuset/cpuset.sched_load_balance"
-SCHED_LB_VALUE="0"
+SCHED_LB_VALUE=

...
-	echo $CHILDREN_VALUE > $CLONE_CHILDREN
-	echo $SCHED_LB_VALUE > $SCHED_LB
+	[ "$CHILDREN_VALUE" ] && echo $CHILDREN_VALUE > $CLONE_CHILDREN
+	[ "$SCHED_LB_VALUE" ] && echo $SCHED_LB_VALUE > $SCHED_LB

Kind regards,
Petr

> Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
> ---
>  testcases/kernel/controllers/cpuset/cpuset_funcs.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
> index 9939f13..3991475 100755
> --- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
> +++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
> @@ -61,7 +61,7 @@ CLONE_CHILDREN="/dev/cpuset/cgroup.clone_children"
>  CHILDREN_VALUE="0"
>  HOTPLUG_CPU="1"
>  SCHED_LB="/dev/cpuset/cpuset.sched_load_balance"
> -SCHED_LB_VALUE="0"
> +SCHED_LB_VALUE="1"

>  cpuset_log()
>  {


More information about the ltp mailing list