Re: [PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes

2017-05-26 Thread Rik van Riel
On Thu, 2017-05-25 at 19:01 -0700, Andy Lutomirski wrote: > On Thu, May 25, 2017 at 6:39 PM, Rik van Riel > wrote: > > On Thu, 2017-05-25 at 17:47 -0700, Andy Lutomirski wrote: > > > > > > +++ b/arch/x86/mm/tlb.c > > > @@ -311,7 +311,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, > > > unsign

Re: [PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes

2017-05-25 Thread Andy Lutomirski
On Thu, May 25, 2017 at 6:39 PM, Rik van Riel wrote: > On Thu, 2017-05-25 at 17:47 -0700, Andy Lutomirski wrote: >> >> +++ b/arch/x86/mm/tlb.c >> @@ -311,7 +311,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, >> unsigned long start, >> goto out; >> } >> >> - if (!current

Re: [PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes

2017-05-25 Thread Nadav Amit
> On May 25, 2017, at 5:47 PM, Andy Lutomirski wrote: > > On a remote TLB flush, we leave_mm() if we're TLBSTATE_LAZY. For a > local flush_tlb_mm_range(), we leave_mm() if !current->mm. These > are approximately the same condition -- the scheduler sets lazy TLB > mode when switching to a threa

Re: [PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes

2017-05-25 Thread Rik van Riel
On Thu, 2017-05-25 at 17:47 -0700, Andy Lutomirski wrote: > > +++ b/arch/x86/mm/tlb.c > @@ -311,7 +311,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, > unsigned long start, >   goto out; >   } >   > - if (!current->mm) { > + if (this_cpu_read(cpu_tlbstate.state) != TLBS

[PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes

2017-05-25 Thread Andy Lutomirski
On a remote TLB flush, we leave_mm() if we're TLBSTATE_LAZY. For a local flush_tlb_mm_range(), we leave_mm() if !current->mm. These are approximately the same condition -- the scheduler sets lazy TLB mode when switching to a thread with no mm. I'm about to merge the local and remote flush code,