cfs-scheduler/starvation.c: Skip test on realtime kernels
PATCH v2 1/1 cfs-scheduler/starvation.c: Skip test on realtime kernels
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.
---
V1: https://lore.kernel.org/ltp/[email protected]/
include/tst_kernel.h | 9 +++++++++ lib/tst_kernel.c | 10 ++++++++++ testcases/kernel/sched/cfs-scheduler/starvation.c | 3 +++ 3 files changed, 22 insertions(+)
include/tst_kernel.h +9 -0
@@ -58,4 +58,13 @@ int tst_check_builtin_driver(const char *driver);*/ int tst_check_driver (const char *driver); +/** +* tst_check_preempt_rt() - Check if the running kernel is RT. +* +* Check support for the kernel module (both built-in and loadable). +* +* Return: -1 if the kernel is RT, 0 otherwise. +*/ +int tst_check_preempt_rt (void ); +#endif /* TST_KERNEL_H__ */
lib/tst_kernel.c +10 -0
@@ -214,3 +214,13 @@ int tst_check_driver(const char *driver)return -1 ; } + +int tst_check_preempt_rt (void ) +{ +struct utsname uval; + +uname (&uval); +if (strstr (uval.version,"PREEMPT_RT" )) +return -1 ; +return 0 ; +}
testcases/kernel/sched/cfs-scheduler/starvation.c +3 -0
@@ -80,6 +80,9 @@ static void setup(void)int cpu =0 ;long ncpus =tst_ncpus_conf (); +if (tst_check_preempt_rt ()) +tst_brk (TCONF ,"This test is not designed for the RT kernel" ); +CPU_ZERO (&mask);/* Restrict test to a single cpu */
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 8 lines · Alessandro Carminati
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.
Quoted 7 lines
Changes include:
- Added a detection mechanism for realtime kernels.
- Logic to skip the test execution if the kernel is identified as realtime.Signed-off-by Alessandro Carminati <[email protected]>
Quoted 66 lines
---
V1:
https://lore.kernel.org/ltp/[email protected]/include/tst_kernel.h | 9 +++++++++ lib/tst_kernel.c | 10 ++++++++++ testcases/kernel/sched/cfs-scheduler/starvation.c | 3 +++ 3 files changed, 22 insertions(+)include/tst_kernel.h +9
-0@@ -58,4 +58,13 @@ int tst_check_builtin_driver(const char *driver);*/ int tst_check_driver (const char *driver); +/** +* tst_check_preempt_rt() - Check if the running kernel is RT. +* +* Check support for the kernel module (both built-in and loadable). +* +* Return: -1 if the kernel is RT, 0 otherwise. +*/ +int tst_check_preempt_rt (void ); +#endif /* TST_KERNEL_H__ */ lib/tst_kernel.c +10
-0@@ -214,3 +214,13 @@ int tst_check_driver(const char *driver)return -1 ; } + +int tst_check_preempt_rt (void ) +{ +struct utsname uval; + +uname (&uval); +if (strstr (uval.version,"PREEMPT_RT" )) +return -1 ; +return 0 ; +}testcases/kernel/sched/cfs-scheduler/starvation.c +3
-0@@ -80,6 +80,9 @@ static void setup(void)int cpu =0 ;long ncpus =tst_ncpus_conf (); +if (tst_check_preempt_rt ()) +tst_brk (TCONF ,"This test is not designed for the RT kernel"); +CPU_ZERO (&mask);/* Restrict test to a single cpu */--
2.34.1
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Alessandro,
LGTM.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
lib/tst_kernel.c int tst_check_driver(const char *driver) · line 224
Quoted 7 lines
lib/tst_kernel.c +7
-0+int tst_check_preempt_rt (void ) +{ +struct utsname uval; + +uname (&uval); +if (strstr (uval.version,"PREEMPT_RT" )) +return -1 ;
Maybe just return 1; here instead.
Otherwise:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hello Cyril,
Thanks for the feedback.
Quoted 11 lines · Cyril Hrubis
Hi!
lib/tst_kernel.c int tst_check_driver(const char *driver) · line 224
Quoted 7 lines
lib/tst_kernel.c +7
-0+int tst_check_preempt_rt (void ) +{ +struct utsname uval; + +uname (&uval); +if (strstr (uval.version,"PREEMPT_RT" )) +return -1 ;Maybe just return 1; here instead.
Fixing in v3 that will follow in a few minutes.
Quoted 9 lines
Otherwise:
Reviewed-by Cyril Hrubis <[email protected]>--
Cyril Hrubis
[email protected]
Signature · 8 lines
--- Thanks Alessandro 172 -- Mailing list info: https://lists.linux.it/listinfo/ltp