From: Alessandro Carminati <acarmina@redhat.com>
To: Petr Vorel <pvorel@suse.cz>
Cc: Alessandro Carminati <acarmina@redhat.com>,
Alessandro Carminati <alessandro.carminati@gmail.com>,
ltp@lists.linux.it
Subject: [LTP] [PATCH] cfs-scheduler/starvation.c: Skip test on realtime kernels
Date: Mon, 20 Jan 2025 08:50:17 +0000 [thread overview]
Message-ID: <20250120085017.63442-1-acarmina@redhat.com> (raw)
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.
Signed-off-by: Alessandro Carminati <acarmina@redhat.com>
---
include/tst_kernel.h | 9 +++++++++
lib/tst_kernel.c | 10 ++++++++++
testcases/kernel/sched/cfs-scheduler/starvation.c | 3 +++
3 files changed, 22 insertions(+)
diff --git a/include/tst_kernel.h b/include/tst_kernel.h
index 5f49952b7..63ecb19a4 100644
--- a/include/tst_kernel.h
+++ b/include/tst_kernel.h
@@ -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__ */
diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c
index 8dabfeba2..7084289c3 100644
--- a/lib/tst_kernel.c
+++ b/lib/tst_kernel.c
@@ -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;
+}
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");
+
/* Restrict test to a single cpu */
if (sched_getaffinity(0, sizeof(mask), &mask) < 0)
tst_brk(TBROK | TERRNO, "sched_getaffinity() failed");
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2025-01-20 9:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 8:50 Alessandro Carminati [this message]
2025-01-20 9:46 ` [LTP] [PATCH] cfs-scheduler/starvation.c: Skip test on realtime kernels Petr Vorel
2025-01-20 10:21 ` Alessandro Carminati
2025-01-21 8:56 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250120085017.63442-1-acarmina@redhat.com \
--to=acarmina@redhat.com \
--cc=alessandro.carminati@gmail.com \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox