Re: [PATCH v3 5/9] x86/mm/tlb: Privatize cpu_tlbstate

From: Andy Lutomirski
Date: Sat Jul 20 2019 - 10:00:50 EST


On Fri, Jul 19, 2019 at 11:54 AM Nadav Amit <namit@xxxxxxxxxx> wrote:
>
> > On Jul 19, 2019, at 11:48 AM, Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
> >
> > On 7/19/19 11:43 AM, Nadav Amit wrote:
> >> Andy said that for the lazy tlb optimizations there might soon be more
> >> shared state. If you prefer, I can move is_lazy outside of tlb_state, and
> >> not set it in any alternative struct.
> >
> > I just wanted to make sure that we capture these rules:
> >
> > 1. If the data is only ever accessed on the "owning" CPU via
> > this_cpu_*(), put it in 'tlb_state'.
> > 2. If the data is read by other CPUs, put it in 'tlb_state_shared'.
> >
> > I actually like the idea of having two structs.
>
> Yes, thatâs exactly the idea. In the (1) case, we may even be able to mark
> the struct with __thread qualifier, which IIRC would prevent memory barriers
> from causing these values being reread.

I'm okay with the patch. If we end up changing things later, we can
rearrange as needed.