Skip to content

Commit 7c944d7

Browse files
arndbpaulmckrcu
authored andcommitted
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: bd5b16d ("refperf: Allow decimal nanoseconds") Reported-by: kbuild test robot <[email protected]> Reported-by: Valdis Klētnieks <[email protected]> Acked-by: Randy Dunlap <[email protected]> # build-tested Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 847dd70 commit 7c944d7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/rcu/refperf.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ static int main_func(void *arg)
478478
if (torture_must_stop())
479479
goto end;
480480

481-
result_avg[exp] = 1000 * process_durations(nreaders) / (nreaders * loops);
481+
result_avg[exp] = div_u64(1000 * process_durations(nreaders), nreaders * loops);
482482
}
483483

484484
// Print the average of all experiments
@@ -489,9 +489,13 @@ static int main_func(void *arg)
489489
strcat(buf, "Runs\tTime(ns)\n");
490490

491491
for (exp = 0; exp < nruns; exp++) {
492+
u64 avg;
493+
u32 rem;
494+
492495
if (errexit)
493496
break;
494-
sprintf(buf1, "%d\t%llu.%03d\n", exp + 1, result_avg[exp] / 1000, (int)(result_avg[exp] % 1000));
497+
avg = div_u64_rem(result_avg[exp], 1000, &rem);
498+
sprintf(buf1, "%d\t%llu.%03u\n", exp + 1, avg, rem);
495499
strcat(buf, buf1);
496500
}
497501

0 commit comments

Comments
 (0)