Commit 7c944d7c authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Paul E. McKenney

refperf: Work around 64-bit division

A 64-bit division was introduced in refperf, breaking compilation
on all 32-bit architectures:

kernel/rcu/refperf.o: in function `main_func':
refperf.c:(.text+0x57c): undefined reference to `__aeabi_uldivmod'

Fix this by using div_u64 to mark the expensive operation.

[ paulmck: Update primitive and format per Nathan Chancellor. ]
Fixes: bd5b16d6c88d ("refperf: Allow decimal nanoseconds")
Reported-by: default avatarkbuild test robot <lkp@intel.com>
Reported-by: default avatarValdis Klētnieks <valdis.kletnieks@vt.edu>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 847dd70a
...@@ -478,7 +478,7 @@ static int main_func(void *arg) ...@@ -478,7 +478,7 @@ static int main_func(void *arg)
if (torture_must_stop()) if (torture_must_stop())
goto end; goto end;
result_avg[exp] = 1000 * process_durations(nreaders) / (nreaders * loops); result_avg[exp] = div_u64(1000 * process_durations(nreaders), nreaders * loops);
} }
// Print the average of all experiments // Print the average of all experiments
...@@ -489,9 +489,13 @@ static int main_func(void *arg) ...@@ -489,9 +489,13 @@ static int main_func(void *arg)
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;
u32 rem;
if (errexit) if (errexit)
break; break;
sprintf(buf1, "%d\t%llu.%03d\n", exp + 1, result_avg[exp] / 1000, (int)(result_avg[exp] % 1000)); avg = div_u64_rem(result_avg[exp], 1000, &rem);
sprintf(buf1, "%d\t%llu.%03u\n", exp + 1, avg, rem);
strcat(buf, buf1); strcat(buf, buf1);
} }
......
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