Skip to contentSkip to conversation

workqueue: avoid unguarded 64-bit division

PATCH Applied Arnd Bergmann 3 participants 3 messages Apr 2 – Apr 7 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 workqueue: avoid unguarded 64-bit division

From: Arnd Bergmann <[email protected]>

The printk() requires a division that is not allowed on 32-bit architectures:

x86_64-linux-ld: lib/test_workqueue.o: in function `test_workqueue_init':
test_workqueue.c:(.init.text+0x36f): undefined reference to `__udivdi3'

Use div_u64() to print the resulting elapsed microseconds.

Fixes 24b2e73f9700 ("workqueue: add test_workqueue benchmark module")
---
 lib/test_workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_workqueue.c +1 -1
index f2ae1ac4bd93..99e160bd5ad1 100644
@@ -242,7 +242,7 @@ static int __init run_bench(int n_threads, const char *scope, const char *label)
 
 	pr_info("test_workqueue:   %-16s %llu items/sec\tp50=%llu\tp90=%llu\tp95=%llu ns\n",
 		label,
-		elapsed_us ? total_items * 1000000ULL / elapsed_us : 0,
+		elapsed_us ? div_u64(total_items * 1000000ULL, elapsed_us) : 0,
 		all_latencies[total_items * 50 / 100],
 		all_latencies[total_items * 90 / 100],
 		all_latencies[total_items * 95 / 100]);
Signature · 1 line
2.39.5
Applied
#1 lore raw

Hello,

Applied to wq/for-7.1.

Thanks.

--
tejun

Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The printk() requires a division that is not allowed on 32-bit architectures:

x86_64-linux-ld: lib/test_workqueue.o: in function `test_workqueue_init':
test_workqueue.c:(.init.text+0x36f): undefined reference to `__udivdi3'

Use div_u64() to print the resulting elapsed microseconds.

Fixes 24b2e73f9700 ("workqueue: add test_workqueue benchmark module")