Re: [RFC 00/13] x86/mm: PCID and INVPCID

From: Andy Lutomirski
Date: Fri Jan 08 2016 - 18:36:38 EST


On Fri, Jan 8, 2016 at 3:31 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Jan 8, 2016 at 3:15 PM, Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>>
>> Please play around and suggest (and run?) good benchmarks. It seems
>> to save around 100ns on cross-process context switches for me.
>
> Interesting. There was reportedly (I never saw it) a test-patch to use
> pcids inside of Intel a couple of years ago, and it never got outside
> because it didn't make a difference.

I have a copy of that patch, and my code works very differently. I
only use 3 bits of PCID in this series. I could probably reduce that
to 2 with little loss. 4 or more would be a waste.

>
> Either things have changed (newer hardware with more pcids perhaps?)
> or you did a better job at it.

On my Skylake laptop, all of the PCID bits appear to have at least
some effect. Whether this means it gets hashed or whether this means
that all of the bits are real, I don't know. I'll fiddle with it on
an older machine.

--Andy