From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] starvation: define the max_runtime
Date: Wed, 27 Nov 2024 20:12:33 +0800 [thread overview]
Message-ID: <20241127121233.14638-2-liwang@redhat.com> (raw)
In-Reply-To: <20241127121233.14638-1-liwang@redhat.com>
Signed-off-by: Li Wang <liwang@redhat.com>
---
.../kernel/sched/cfs-scheduler/starvation.c | 38 +------------------
1 file changed, 1 insertion(+), 37 deletions(-)
diff --git a/testcases/kernel/sched/cfs-scheduler/starvation.c b/testcases/kernel/sched/cfs-scheduler/starvation.c
index e707e0865..cd6739a24 100644
--- a/testcases/kernel/sched/cfs-scheduler/starvation.c
+++ b/testcases/kernel/sched/cfs-scheduler/starvation.c
@@ -21,38 +21,9 @@
#include <sched.h>
#include "tst_test.h"
-#include "tst_safe_clocks.h"
-#include "tst_timer.h"
static char *str_loop;
static long loop = 1000000;
-static char *str_timeout;
-static int timeout;
-
-#define CALLIBRATE_LOOPS 120000000
-
-static int callibrate(void)
-{
- int i;
- struct timespec start, stop;
- long long diff;
-
- for (i = 0; i < CALLIBRATE_LOOPS; i++)
- __asm__ __volatile__ ("" : "+g" (i) : :);
-
- SAFE_CLOCK_GETTIME(CLOCK_MONOTONIC_RAW, &start);
-
- for (i = 0; i < CALLIBRATE_LOOPS; i++)
- __asm__ __volatile__ ("" : "+g" (i) : :);
-
- SAFE_CLOCK_GETTIME(CLOCK_MONOTONIC_RAW, &stop);
-
- diff = tst_timespec_diff_us(stop, start);
-
- tst_res(TINFO, "CPU did %i loops in %llius", CALLIBRATE_LOOPS, diff);
-
- return diff;
-}
static int wait_for_pid(pid_t pid)
{
@@ -102,13 +73,6 @@ static void setup(void)
if (tst_parse_long(str_loop, &loop, 1, LONG_MAX))
tst_brk(TBROK, "Invalid number of loop number '%s'", str_loop);
-
- if (tst_parse_int(str_timeout, &timeout, 1, INT_MAX))
- tst_brk(TBROK, "Invalid number of timeout '%s'", str_timeout);
- else
- timeout = callibrate() / 1000;
-
- tst_set_max_runtime(timeout);
}
static void handler(int sig LTP_ATTRIBUTE_UNUSED)
@@ -158,8 +122,8 @@ static struct tst_test test = {
.forks_child = 1,
.options = (struct tst_option[]) {
{"l:", &str_loop, "Number of loops (default 2000000)"},
- {"t:", &str_timeout, "Max timeout (default 240s)"},
{}
},
+ .max_runtime = 120,
.needs_checkpoints = 1,
};
--
2.47.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-11-27 12:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 12:12 [LTP] [PATCH 1/2] lib: add extra calibrated runtime to slow tests Li Wang
2024-11-27 12:12 ` Li Wang [this message]
2024-12-03 12:18 ` Cyril Hrubis
2024-12-06 9:27 ` Li Wang
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=20241127121233.14638-2-liwang@redhat.com \
--to=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/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