Re: x86/asm: __clear_user() micro-optimization (was: "Re: [GIT PULL] x86/asm changes for v4.18")
From: Linus Torvalds
Date: Tue Jun 05 2018 - 11:47:42 EST
On Tue, Jun 5, 2018 at 8:05 AM Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> Ok, fair point and agreed - if Alexey sends some measurements to back the change
> I'll keep this, otherwise queue up a revert.
I don't think it needs to be reverted, it's not like it's likely to
hurt on any modern CPU's. The issues I talked about are fairly
historical - barely even 64-bit cpus - and I'm not sure an extra uop
to carry a constant around even matters in that code sequence.
It was more a generic issue - any micro-optimization should be based
on numbers (and there should be some numbers in the commit message),
not on "this should be faster". Because while intuitively immediates
_should_ be faster than registers, that's simply not always "obviously
true". It _may_ be true. But numbers talk.
Linus