]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
workqueue: avoid unguarded 64-bit division
authorArnd Bergmann <arnd@arndb.de>
Thu, 2 Apr 2026 20:59:03 +0000 (22:59 +0200)
committerTejun Heo <tj@kernel.org>
Fri, 3 Apr 2026 17:14:24 +0000 (07:14 -1000)
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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
lib/test_workqueue.c

index f2ae1ac4bd93717ad215b99c69e299628bc19158..99e160bd5ad174a578edcd2421e069e84c212095 100644 (file)
@@ -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]);