mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] block: iolatency: avoid 64-bit division
@ 2018-07-10 15:21 Arnd Bergmann
  2018-07-10 18:28 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2018-07-10 15:21 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Arnd Bergmann, Tejun Heo, Josef Bacik, linux-block, linux-kernel

On 32-bit architectures, dividing a 64-bit number needs to use the
do_div() function or something like it to avoid a link failure:

block/blk-iolatency.o: In function `iolatency_prfill_limit':
blk-iolatency.c:(.text+0x8cc): undefined reference to `__aeabi_uldivmod'

Using div_u64() gives us the best output and avoids the need for an
explicit cast.

Fixes: d70675121546 ("block: introduce blk-iolatency io controller")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 block/blk-iolatency.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index a35a1f580337..56ddb2c68752 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -798,8 +798,7 @@ static u64 iolatency_prfill_limit(struct seq_file *sf,
 	if (!dname || !iolat->min_lat_nsec)
 		return 0;
 	seq_printf(sf, "%s target=%llu\n",
-		   dname,
-		   (unsigned long long)iolat->min_lat_nsec / NSEC_PER_USEC);
+		   dname, div_u64(iolat->min_lat_nsec, NSEC_PER_USEC));
 	return 0;
 }
 
-- 
2.9.0


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

* Re: [PATCH] block: iolatency: avoid 64-bit division
  2018-07-10 15:21 [PATCH] block: iolatency: avoid 64-bit division Arnd Bergmann
@ 2018-07-10 18:28 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2018-07-10 18:28 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Tejun Heo, Josef Bacik, linux-block, linux-kernel

On 7/10/18 9:21 AM, Arnd Bergmann wrote:
> On 32-bit architectures, dividing a 64-bit number needs to use the
> do_div() function or something like it to avoid a link failure:
> 
> block/blk-iolatency.o: In function `iolatency_prfill_limit':
> blk-iolatency.c:(.text+0x8cc): undefined reference to `__aeabi_uldivmod'
> 
> Using div_u64() gives us the best output and avoids the need for an
> explicit cast.

Applied, thanks Arnd.

-- 
Jens Axboe


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

end of thread, other threads:[~2018-07-10 18:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10 15:21 [PATCH] block: iolatency: avoid 64-bit division Arnd Bergmann
2018-07-10 18:28 ` Jens Axboe

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

all inboxes | Powered by JetHome®