mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: David Laight <David.Laight@ACULAB.COM>,
	"'Thorsten Blum'" <thorsten.blum@toblux.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Wei Liu <wei.liu@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] x86/apic: Use div64_ul() instead of do_div()
Date: Thu, 29 Feb 2024 17:01:43 -0800	[thread overview]
Message-ID: <96394DFF-43D7-4877-AA47-FC847FD26184@zytor.com> (raw)
In-Reply-To: <7e46123775e64898bd7c467328125ee0@AcuMS.aculab.com>

>> 
>> 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.




  reply	other threads:[~2024-03-01  1:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 11:43 Thorsten Blum
2024-02-29 22:13 ` David Laight
2024-03-01  1:01   ` H. Peter Anvin [this message]
2024-03-01  8:53     ` David Laight
2024-03-01 12:28   ` Thorsten Blum
2024-03-01 20:39     ` [PATCH v2] x86/apic: Use u32 instead of unsigned long Thorsten Blum
2024-03-08 12:43       ` [RESEND PATCH " Thorsten Blum
2024-03-08 16:12         ` Dave Hansen
2024-03-08 19:50           ` Thorsten Blum
2024-03-08 23:02             ` [PATCH v3] x86/apic: Improve data types to fix Coccinelle warnings Thorsten Blum
2024-03-18 10:47               ` [RESEND PATCH " Thorsten Blum
2024-03-18 16:13                 ` Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96394DFF-43D7-4877-AA47-FC847FD26184@zytor.com \
    --to=hpa@zytor.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=thorsten.blum@toblux.com \
    --cc=wei.liu@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®