diff mbox series

controllers/cpuset: default cpuset.sched_load_balance to 1

Message ID 1653636077-13606-1-git-send-email-zhanghongchen@loongson.cn
State Superseded
Headers show
Series controllers/cpuset: default cpuset.sched_load_balance to 1 | expand

Commit Message

Hongchen Zhang May 27, 2022, 7:21 a.m. UTC
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.

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

Comments

Petr Vorel June 13, 2022, 3:08 p.m. UTC | #1
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()
>  {
Petr Vorel June 13, 2022, 3:13 p.m. UTC | #2
Hi Hongchen,

The script is really messy that I understand why people are rewriting cgroup
tests into C which has also cgroup v2 support among other improvements. Although
FYI there is ongoing effort to add this cgroup v2 support also to shell tests,
my guess is that sooner or later anything relevant will be rewritten to LTP C API.

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/project/ltp/list/?series=297465&state=*
diff mbox series

Patch

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()
 {