Re: [PATCH 01/25] x86: Make SMAP 64-bit only

From: Linus Torvalds
Date: Thu Mar 21 2019 - 14:21:30 EST


On Thu, Mar 21, 2019 at 10:25 AM Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
>
> >
> > But iirc pushf/popf isn't really that expensive - in fact I think it's
> > pretty cheap when system flags don't change.
>
> I did not see evidence of this. In my testing,
> POPF is always ~20 cycles, even if popped flags are identical to current
> state of flags.

It may have been an artifact on just some older CPU's. I have this
distinct memory of popf that changed IF being more expensive, but
maybe that was the Pentium 4 days.

Or maybe it's just that my memory is garbage.

Linus