[LTP] [PATCH] cfs-scheduler/starvation.c: Skip test on realtime kernels

Petr Vorel pvorel@suse.cz
Mon Jan 20 10:46:34 CET 2025


Hi Alessandro,

> This commit introduces a check in the starvation test case to detect and
> skip execution on realtime kernels. The test is designed for use with the
> Completely Fair Scheduler and produces meaningless results when run on
> realtime kernels.

> By skipping the test on realtime kernels, we avoid confusion caused by
> misleading results.

> Changes include:
> - Added a detection mechanism for realtime kernels.
> - Logic to skip the test execution if the kernel is identified as
>   realtime.

LGTM. Could you please test if starvation.c worked previously?
Or was it always broken?

Reviewed-by: Petr Vorel <pvorel@suse.cz>

> +int tst_check_preempt_rt(void)
> +{
> +	struct utsname uval;
> +
> +	uname(&uval);
> +	if (strstr(uval.version, "PREEMPT_RT"))
> +		return -1;
> +	return 0;
> +}
> diff --git a/testcases/kernel/sched/cfs-scheduler/starvation.c b/testcases/kernel/sched/cfs-scheduler/starvation.c
> index 901556a7b..c620c9c3e 100644
> --- a/testcases/kernel/sched/cfs-scheduler/starvation.c
> +++ b/testcases/kernel/sched/cfs-scheduler/starvation.c
> @@ -82,6 +82,9 @@ static void setup(void)

>  	CPU_ZERO(&mask);

> +	if (tst_check_preempt_rt())
> +		tst_brk(TCONF, "This test is not designed for the RT kernel");
nit: I would move it above CPU_ZERO().

NOTE: we should also move tst_has_slow_kconfig() check to be at the top of
setup(). But that's unrelated. Also at least on Tumbleweed and SLES which get
detected as slow due CONFIG_LATENCYTOP test was worked before.

Kind regards,
Petr


More information about the ltp mailing list