Commit c30c8763 authored by Li Zhijian's avatar Li Zhijian Committed by Paul E. McKenney

refscale: Simplify the errexit checkpoint

There is only the one OOM error case in main_func(), so this commit
eliminates the errexit local variable in favor of a branch to cleanup
code.
Signed-off-by: default avatarLi Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 340170fe
...@@ -637,7 +637,6 @@ static u64 process_durations(int n) ...@@ -637,7 +637,6 @@ static u64 process_durations(int n)
// point all the timestamps are printed. // point all the timestamps are printed.
static int main_func(void *arg) static int main_func(void *arg)
{ {
bool errexit = false;
int exp, r; int exp, r;
char buf1[64]; char buf1[64];
char *buf; char *buf;
...@@ -651,7 +650,7 @@ static int main_func(void *arg) ...@@ -651,7 +650,7 @@ static int main_func(void *arg)
buf = kzalloc(64 + nruns * 32, GFP_KERNEL); buf = kzalloc(64 + nruns * 32, GFP_KERNEL);
if (!result_avg || !buf) { if (!result_avg || !buf) {
VERBOSE_SCALEOUT_ERRSTRING("out of memory"); VERBOSE_SCALEOUT_ERRSTRING("out of memory");
errexit = true; goto oom_exit;
} }
if (holdoff) if (holdoff)
schedule_timeout_interruptible(holdoff * HZ); schedule_timeout_interruptible(holdoff * HZ);
...@@ -663,8 +662,6 @@ static int main_func(void *arg) ...@@ -663,8 +662,6 @@ static int main_func(void *arg)
// Start exp readers up per experiment // Start exp readers up per experiment
for (exp = 0; exp < nruns && !torture_must_stop(); exp++) { for (exp = 0; exp < nruns && !torture_must_stop(); exp++) {
if (errexit)
break;
if (torture_must_stop()) if (torture_must_stop())
goto end; goto end;
...@@ -698,26 +695,22 @@ static int main_func(void *arg) ...@@ -698,26 +695,22 @@ static int main_func(void *arg)
// Print the average of all experiments // Print the average of all experiments
SCALEOUT("END OF TEST. Calculating average duration per loop (nanoseconds)...\n"); SCALEOUT("END OF TEST. Calculating average duration per loop (nanoseconds)...\n");
if (!errexit) {
buf[0] = 0; buf[0] = 0;
strcat(buf, "\n"); strcat(buf, "\n");
strcat(buf, "Runs\tTime(ns)\n"); strcat(buf, "Runs\tTime(ns)\n");
}
for (exp = 0; exp < nruns; exp++) { for (exp = 0; exp < nruns; exp++) {
u64 avg; u64 avg;
u32 rem; u32 rem;
if (errexit)
break;
avg = div_u64_rem(result_avg[exp], 1000, &rem); avg = div_u64_rem(result_avg[exp], 1000, &rem);
sprintf(buf1, "%d\t%llu.%03u\n", exp + 1, avg, rem); sprintf(buf1, "%d\t%llu.%03u\n", exp + 1, avg, rem);
strcat(buf, buf1); strcat(buf, buf1);
} }
if (!errexit)
SCALEOUT("%s", buf); SCALEOUT("%s", buf);
oom_exit:
// This will shutdown everything including us. // This will shutdown everything including us.
if (shutdown) { if (shutdown) {
shutdown_start = 1; shutdown_start = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment