From: Li Zhijian <lizhijian@cn.fujitsu.com>
To: <dave@stgolabs.net>, <paulmck@kernel.org>,
<josh@joshtriplett.org>, <rostedt@goodmis.org>,
<mathieu.desnoyers@efficios.com>, <jiangshanlai@gmail.com>,
<joel@joelfernandes.org>, <rcu@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, Li Zhijian <lizhijian@cn.fujitsu.com>
Subject: [PATCH 1/3] refscale: simplify the errexit checkpoint
Date: Mon, 25 Oct 2021 11:26:56 +0800 [thread overview]
Message-ID: <20211025032658.22889-1-lizhijian@cn.fujitsu.com> (raw)
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
V2: permit further simplification # Paul
---
kernel/rcu/refscale.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index 66dc14cf5687..d97427e0b9d5 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -637,7 +637,6 @@ static u64 process_durations(int n)
// point all the timestamps are printed.
static int main_func(void *arg)
{
- bool errexit = false;
int exp, r;
char buf1[64];
char *buf;
@@ -651,7 +650,7 @@ static int main_func(void *arg)
buf = kzalloc(64 + nruns * 32, GFP_KERNEL);
if (!result_avg || !buf) {
VERBOSE_SCALEOUT_ERRSTRING("out of memory");
- errexit = true;
+ goto oom_exit;
}
if (holdoff)
schedule_timeout_interruptible(holdoff * HZ);
@@ -663,8 +662,6 @@ static int main_func(void *arg)
// Start exp readers up per experiment
for (exp = 0; exp < nruns && !torture_must_stop(); exp++) {
- if (errexit)
- break;
if (torture_must_stop())
goto end;
@@ -698,26 +695,22 @@ static int main_func(void *arg)
// Print the average of all experiments
SCALEOUT("END OF TEST. Calculating average duration per loop (nanoseconds)...\n");
- if (!errexit) {
- buf[0] = 0;
- strcat(buf, "\n");
- strcat(buf, "Runs\tTime(ns)\n");
- }
+ buf[0] = 0;
+ strcat(buf, "\n");
+ strcat(buf, "Runs\tTime(ns)\n");
for (exp = 0; exp < nruns; exp++) {
u64 avg;
u32 rem;
- if (errexit)
- break;
avg = div_u64_rem(result_avg[exp], 1000, &rem);
sprintf(buf1, "%d\t%llu.%03u\n", exp + 1, avg, rem);
strcat(buf, buf1);
}
- if (!errexit)
- SCALEOUT("%s", buf);
+ SCALEOUT("%s", buf);
+oom_exit:
// This will shutdown everything including us.
if (shutdown) {
shutdown_start = 1;
--
2.33.0
next reply other threads:[~2021-10-25 3:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 3:26 Li Zhijian [this message]
2021-10-25 3:26 ` [PATCH 2/3] refscale: prevent buffer to pr_alert() being too long Li Zhijian
2021-10-25 3:26 ` [PATCH 3/3] refscale: always log the error message Li Zhijian
2021-10-25 6:12 ` lizhijian
2021-10-26 14:06 ` Paul E. McKenney
2021-10-27 5:18 ` lizhijian
2021-10-27 7:21 ` lizhijian
2021-10-28 13:30 ` Paul E. McKenney
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=20211025032658.22889-1-lizhijian@cn.fujitsu.com \
--to=lizhijian@cn.fujitsu.com \
--cc=dave@stgolabs.net \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.