sched/starvation: Choose from available cpus
PATCH 1/1 sched/starvation: Choose from available cpus
Use the first available cpu in the sched_getaffinity set.
This test was failing as a 32bit test for some arm architectures where cpu 0 does not support 32bit applications.
--- .../kernel/sched/cfs-scheduler/starvation.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
testcases/kernel/sched/cfs-scheduler/starvation.c +16 -1
@@ -49,13 +49,28 @@ again:static void setup (void ) {cpu_set_t mask; +int cpu =0 ; +long ncpus =tst_ncpus_conf ();CPU_ZERO (&mask); -CPU_SET (0 , &mask); +/* Restrict test to a single cpu */ +TST_EXP_POSITIVE (sched_getaffinity (0 ,sizeof (mask), &mask)); + +if (CPU_COUNT (&mask) ==0 ) +tst_brk (TCONF ,"No cpus available" ); + +while (CPU_ISSET (cpu, &mask) ==0 && cpu < ncpus) + cpu++; + +CPU_ZERO (&mask); + +CPU_SET (cpu, &mask);TST_EXP_POSITIVE (sched_setaffinity (0 ,sizeof (mask), &mask)); +tst_res (TINFO ,"Set affinity to CPU %d" , cpu); +if (tst_parse_long (str_loop, &loop,1 ,LONG_MAX ))tst_brk (TBROK ,"Invalid number of loop number '%s'" , str_loop);
Signature · 5 lines
2.45.1.467.gbab1589fc0-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Edward,
Quoted 4 lines
Use the first available cpu in the
sched_getaffinityset.This test was failing as a 32bit test for some arm architectures where cpu 0 does not support 32bit applications.
LGTM.
Cc Wei (the original author).
Kind regards,
Petr
Quoted 38 lines
Signed-off-by Edward Liaw <[email protected]>--- .../kernel/sched/cfs-scheduler/starvation.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)testcases/kernel/sched/cfs-scheduler/starvation.c +16
-1@@ -49,13 +49,28 @@ again:static void setup (void ) {cpu_set_t mask; +int cpu =0 ; +long ncpus =tst_ncpus_conf ();CPU_ZERO (&mask); -CPU_SET (0 , &mask); +/* Restrict test to a single cpu */ +TST_EXP_POSITIVE (sched_getaffinity (0 ,sizeof (mask), &mask)); + +if (CPU_COUNT (&mask) ==0 ) +tst_brk (TCONF ,"No cpus available" ); + +while (CPU_ISSET (cpu, &mask) ==0 && cpu < ncpus) + cpu++; + +CPU_ZERO (&mask); + +CPU_SET (cpu, &mask);TST_EXP_POSITIVE (sched_setaffinity (0 ,sizeof (mask), &mask)); +tst_res (TINFO ,"Set affinity to CPU %d" , cpu); +if (tst_parse_long (str_loop, &loop,1 ,LONG_MAX ))tst_brk (TBROK ,"Invalid number of loop number '%s'" , str_loop);
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 16 lines · Edward Liaw via ltp
Use the first available cpu in the
sched_getaffinityset.This test was failing as a 32bit test for some arm architectures where cpu 0 does not support 32bit applications.
Signed-off-by Edward Liaw <[email protected]>--- .../kernel/sched/cfs-scheduler/starvation.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)testcases/kernel/sched/cfs-scheduler/starvation.c +0
-0@@ -49,13 +49,28 @@ again:static void setup (void )
testcases/kernel/sched/cfs-scheduler/starvation.c again: · line 58
Quoted 10 lines
testcases/kernel/sched/cfs-scheduler/starvation.c +4
-1{cpu_set_t mask; +int cpu =0 ; +long ncpus =tst_ncpus_conf ();CPU_ZERO (&mask); -CPU_SET (0 , &mask); +/* Restrict test to a single cpu */ +TST_EXP_POSITIVE (sched_getaffinity (0 ,sizeof (mask), &mask));
s/TST_EXP_POSITIVE/TST_EXP_PASS
testcases/kernel/sched/cfs-scheduler/starvation.c again: · line 61
Quoted 3 lines
testcases/kernel/sched/cfs-scheduler/starvation.c +3
-0+ +if (CPU_COUNT (&mask) ==0 ) +tst_brk (TCONF ,"No cpus available" );
I suppose this should a bug happen if cpu count is 0, so i suggest s/TCONF/TBROK. What do you think?
testcases/kernel/sched/cfs-scheduler/starvation.c again: · line 70
Quoted 9 lines
testcases/kernel/sched/cfs-scheduler/starvation.c +7
-0+ +while (CPU_ISSET (cpu, &mask) ==0 && cpu < ncpus) + cpu++; + +CPU_ZERO (&mask); + +CPU_SET (cpu, &mask);TST_EXP_POSITIVE (sched_setaffinity (0 ,sizeof (mask), &mask));
s/TST_EXP_POSITIVE/TST_EXP_PASS
testcases/kernel/sched/cfs-scheduler/starvation.c again: · line 76
Quoted 6 lines
testcases/kernel/sched/cfs-scheduler/starvation.c +2
-0+tst_res (TINFO ,"Set affinity to CPU %d" , cpu); +if (tst_parse_long (str_loop, &loop,1 ,LONG_MAX ))tst_brk (TBROK ,"Invalid number of loop number '%s'" , str_loop);
Others LGTM. Thanks for your nice patch!
Quoted 6 lines
Signature · 5 lines
2.45.1.467.gbab1589fc0-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 23 lines · Wei Gao
Quoted 21 lines · Edward Liaw via ltp
Use the first available cpu in the
sched_getaffinityset.This test was failing as a 32bit test for some arm architectures where cpu 0 does not support 32bit applications.
Signed-off-by Edward Liaw <[email protected]>--- .../kernel/sched/cfs-scheduler/starvation.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)testcases/kernel/sched/cfs-scheduler/starvation.c +2
-0@@ -49,13 +49,28 @@ again:static void setup (void ) {cpu_set_t mask; +int cpu =0 ; +long ncpus =tst_ncpus_conf ();
Quoted 6 lines
testcases/kernel/sched/cfs-scheduler/starvation.c again: · line 58
Quoted 5 lines
testcases/kernel/sched/cfs-scheduler/starvation.c +2
-1CPU_ZERO (&mask); -CPU_SET (0 , &mask); +/* Restrict test to a single cpu */ +TST_EXP_POSITIVE (sched_getaffinity (0 ,sizeof (mask), &mask));s/TST_EXP_POSITIVE/TST_EXP_PASS
Will do.
Quoted 5 lines
testcases/kernel/sched/cfs-scheduler/starvation.c again: · line 61
Quoted 3 lines
testcases/kernel/sched/cfs-scheduler/starvation.c +3
-0+ +if (CPU_COUNT (&mask) ==0 ) +tst_brk (TCONF ,"No cpus available" );I suppose this should a bug happen if cpu count is 0, so i suggest s/TCONF/TBROK. What do you think?
Yeah that makes more sense. Will send a v2.
Quoted 12 lines
testcases/kernel/sched/cfs-scheduler/starvation.c again: · line 70
Quoted 10 lines
testcases/kernel/sched/cfs-scheduler/starvation.c +7
-0+ +while (CPU_ISSET (cpu, &mask) ==0 && cpu < ncpus) + cpu++; + +CPU_ZERO (&mask); + +CPU_SET (cpu, &mask);TST_EXP_POSITIVE (sched_setaffinity (0 ,sizeof (mask), &mask));s/TST_EXP_POSITIVE/TST_EXP_PASS
Quoted 1 line
Quoted 6 lines
testcases/kernel/sched/cfs-scheduler/starvation.c again: · line 75
Quoted 5 lines
testcases/kernel/sched/cfs-scheduler/starvation.c +2
-0+tst_res (TINFO ,"Set affinity to CPU %d" , cpu); +if (tst_parse_long (str_loop, &loop,1 ,LONG_MAX ))tst_brk (TBROK ,"Invalid number of loop number '%s'" , str_loop);Others LGTM. Thanks for your nice patch!
Thanks!
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp