Re: [RFC PATCH v2 08/12] x86/tlb: Privatize cpu_tlbstate

From: Nadav Amit
Date: Fri May 31 2019 - 15:46:28 EST


> On May 31, 2019, at 11:48 AM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>
>
>> On May 30, 2019, at 11:36 PM, Nadav Amit <namit@xxxxxxxxxx> wrote:
>>
>> cpu_tlbstate is mostly private and only the variable is_lazy is shared.
>> This causes some false-sharing when TLB flushes are performed.
>>
>> Break cpu_tlbstate intro cpu_tlbstate and cpu_tlbstate_shared, and mark
>> each one accordingly.
>
> At some point weâll want to do a better job with our PV flush code, and I
> suspect weâll end up with more of this shared again.

In the usual use-case, when you flush the TLB, will you write something to
cpu_tlbstate that should be visible to other cores? I donât see why, even if
PV is used.

Anyhow, I was always under the impression that PV should not punish
bare-metal.

The other option is to take cpu_tlbstate and rearrange it so the shared
stuff will not be next to the private. I just donât know how to do it
without making an assumption of the cacheline size.