sched/starvation: Choose from available cpus
v3 cover sched/starvation: Choose from available cpus
The starvation test was failing as a 32bit test for some arm architectures where cpu 0 cpu 0 does not support 32bit applications.
v1: https://lore.kernel.org/ltp/[email protected]/
v2: https://lore.kernel.org/ltp/[email protected]/
Made these substitutions based on Wei's suggestions:
s/TST_EXP_POSITIVE/TST_EXP_PASS
s/TCONF/TBROK
v3:
Substituted test macros with check based on Petr's suggestions. Split commit into two: one to fix the return code check on sched_setaffinity.
Edward Liaw (1):
sched/starvation: Fix sched_setaffinity return check
Edward Liaw via ltp (1):
sched/starvation: Choose from available cpus
.../kernel/sched/cfs-scheduler/starvation.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
--
2.45.2.505.gda0bf45e8d-goog
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 1/2 sched/starvation: Fix sched_setaffinity return check
TST_EXP_POSITIVE to check the return value is incorrect because sched_setaffinity returns 0 on success / -1 on failure.
--- testcases/kernel/sched/cfs-scheduler/starvation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/sched/cfs-scheduler/starvation.c +2 -1
@@ -54,7 +54,8 @@ static void setup(void)CPU_SET (0 , &mask); -TST_EXP_POSITIVE (sched_setaffinity (0 ,sizeof (mask), &mask)); +if (!sched_setaffinity (0 ,sizeof (mask), &mask)) +tst_brk (TBROK |TERRNO ,"sched_setaffinity() failed" );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.2.505.gda0bf45e8d-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 2/2 sched/starvation: Choose from available cpus
In reply to Edward Liaw via ltpFrom: Edward Liaw via ltp <[email protected]>
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 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
testcases/kernel/sched/cfs-scheduler/starvation.c +17 -1
@@ -49,10 +49,26 @@ 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 */ +if (!sched_getaffinity (0 ,sizeof (mask), &mask)) +tst_brk (TBROK |TERRNO ,"sched_getaffinity() failed" ); + +if (CPU_COUNT (&mask) ==0 ) +tst_brk (TBROK ,"No cpus available" ); + +while (CPU_ISSET (cpu, &mask) ==0 && cpu < ncpus) + cpu++; + +CPU_ZERO (&mask); + +CPU_SET (cpu, &mask); + +tst_res (TINFO ,"Setting affinity to CPU %d" , cpu);if (!sched_setaffinity (0 ,sizeof (mask), &mask))tst_brk (TBROK |TERRNO ,"sched_setaffinity() failed" );
Signature · 5 lines
2.45.2.505.gda0bf45e8d-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp