public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] workqueue: avoid unguarded 64-bit division
@ 2026-04-02 20:59 Arnd Bergmann
  2026-04-03 17:50 ` Tejun Heo
  2026-04-07 14:03 ` Breno Leitao
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-04-02 20:59 UTC (permalink / raw)
  To: Andrew Morton, Tejun Heo, Breno Leitao; +Cc: Arnd Bergmann, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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>
---
 lib/test_workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_workqueue.c b/lib/test_workqueue.c
index f2ae1ac4bd93..99e160bd5ad1 100644
--- a/lib/test_workqueue.c
+++ b/lib/test_workqueue.c
@@ -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]);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] workqueue: avoid unguarded 64-bit division
  2026-04-02 20:59 [PATCH] workqueue: avoid unguarded 64-bit division Arnd Bergmann
@ 2026-04-03 17:50 ` Tejun Heo
  2026-04-07 14:03 ` Breno Leitao
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2026-04-03 17:50 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Andrew Morton, Breno Leitao, Arnd Bergmann, linux-kernel

Hello,

Applied to wq/for-7.1.

Thanks.

--
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] workqueue: avoid unguarded 64-bit division
  2026-04-02 20:59 [PATCH] workqueue: avoid unguarded 64-bit division Arnd Bergmann
  2026-04-03 17:50 ` Tejun Heo
@ 2026-04-07 14:03 ` Breno Leitao
  1 sibling, 0 replies; 3+ messages in thread
From: Breno Leitao @ 2026-04-07 14:03 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Andrew Morton, Tejun Heo, Arnd Bergmann, linux-kernel

On Thu, Apr 02, 2026 at 10:59:03PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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>

Reviewed-by: Breno Leitao <leitao@debian.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-07 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 20:59 [PATCH] workqueue: avoid unguarded 64-bit division Arnd Bergmann
2026-04-03 17:50 ` Tejun Heo
2026-04-07 14:03 ` Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox