RE: [PATCH] xfs: Fix 64-bit division on 32-bit in xlog_state_switch_iclogs()

From: David Laight
Date: Mon Jun 14 2021 - 04:18:44 EST


From: Geert Uytterhoeven
> Sent: 11 June 2021 07:55
> Hi Dave,
>
> On Fri, Jun 11, 2021 at 12:02 AM Dave Chinner <david@xxxxxxxxxxxxx> wrote:
> > On Thu, Jun 10, 2021 at 01:00:01PM +0200, Geert Uytterhoeven wrote:
...
> > 64 bit division on 32 bit platforms is still a problem in this day
> > and age?
>
> They're not a problem. But you should use the right operations from
> <linux/math64.h>, iff you really need these expensive operations.

(64bit) division isn't exactly cheap on 64bit cpus.

Some timing tables for x86 give latencies of well over 1 bit/clock
for Intel cpus, AMD ryzen manage 2 bits/clock.
Signed divide is also significantly more expensive than
unsigned divide.

Integer divide performance is clearly not important enough
to throw silicon at.
The same tables show fdiv having a latency of 16 clocks.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)