[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180605150514.GA31065@gmail.com>
Date: Tue, 5 Jun 2018 17:05:14 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Alexey Dobriyan <adobriyan@...il.com>
Cc: Alexey Dobriyan <adobriyan@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Josh Poimboeuf <jpoimboe@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Denys Vlasenko <dvlasenk@...hat.com>
Subject: Re: x86/asm: __clear_user() micro-optimization (was: "Re: [GIT PULL]
x86/asm changes for v4.18")
* Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Mon, Jun 4, 2018 at 5:21 AM Ingo Molnar <mingo@...nel.org> wrote:
> >
> > - __clear_user() micro-optimization (Alexey Dobriyan)
>
> Was this actually tested?
I'm not sure - Alexey?
> I think one reason people avoided the constant was that on some
> microarchitecture it ended up being a separate uop just for the
> constant generation, because it wouldn't fit in a single uop.
>
> I'm pretty sure that used to be the case for P4, for example.
>
> Afaik there have also been issues with decoding instructions that have
> both an immediate and a memory offset.
>
> I suspect none of this is an issue on modern cores, but there really
> at least historically were cases where
>
> mov %reg,mem
>
> was better than
>
> mov $imm,mem
>
> if %reg already had the right value, so it's not at all 100% obvious
> that the micro-optimization really _optimizes_ anything.
>
> Any time people do this, they should add numbers.
Ok, fair point and agreed - if Alexey sends some measurements to back the change
I'll keep this, otherwise queue up a revert.
Thanks,
Ingo
Powered by blists - more mailing lists