[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <96394DFF-43D7-4877-AA47-FC847FD26184@zytor.com>
Date: Thu, 29 Feb 2024 17:01:43 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: David Laight <David.Laight@...LAB.COM>,
"'Thorsten Blum'" <thorsten.blum@...lux.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"x86@...nel.org" <x86@...nel.org>
CC: "Peter Zijlstra (Intel)" <peterz@...radead.org>,
Wei Liu <wei.liu@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] x86/apic: Use div64_ul() instead of do_div()
>>
>> Change deltapm to unsigned long and replace do_div() with div64_ul()
>> which doesn't implicitly cast the divisor and doesn't unnecessarily
>> calculate the remainder.
>
>Eh? they are entirely different beasts.
>
>do_div() does a 64 by 32 divide that gives a 32bit quotient.
>div64_ul() does a much more expensive 64 by 64 divide that
>can generate a 64bit quotient.
>
>The remainder is pretty much free in both cases.
>If a cpu has a divide instruction it will almost certainly
>put the result in one register and the quotient in another.
>
Not on e.g. RISC-V.
Powered by blists - more mailing lists