lkml.org 
[lkml]   [2018]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/7] x86,tlb: leave lazy TLB mode at page table free time
From
Date
On Fri, 2018-06-22 at 07:58 -0700, Andy Lutomirski wrote:
> On Wed, Jun 20, 2018 at 12:57 PM Rik van Riel <riel@surriel.com>
> wrote:
> >
> > +++ b/arch/x86/mm/tlb.c
> > @@ -646,6 +646,30 @@ void flush_tlb_mm_range(struct mm_struct *mm,
> > unsigned long start,
> > put_cpu();
> > }
> >
> > +void tlb_flush_remove_tables_local(void *arg)
> > +{
> > + struct mm_struct *mm = arg;
> > +
> > + if (this_cpu_read(cpu_tlbstate.loaded_mm) == mm &&
> > + this_cpu_read(cpu_tlbstate.is_lazy))
> > + /*
> > + * We're in lazy mode. We need to at least flush
> > our
> > + * paging-structure cache to avoid speculatively
> > reading
> > + * garbage into our TLB. Since switching to
> > init_mm is barely
> > + * slower than a minimal flush, just switch to
> > init_mm.
> > + */
> > + switch_mm_irqs_off(NULL, &init_mm, NULL);
>
> Can you add braces?

Will do.

> > +}
> > +
> > +void tlb_flush_remove_tables(struct mm_struct *mm)
> > +{
> > + int cpu = get_cpu();
> > + /*
> > + * XXX: this really only needs to be called for CPUs in
> > lazy TLB mode.
> > + */
> > + if (cpumask_any_but(mm_cpumask(mm), cpu) < nr_cpu_ids)
> > + smp_call_function_many(mm_cpumask(mm),
> > tlb_flush_remove_tables_local, (void *)mm, 1);
>
> I suspect that most if the gain will come from fixing this limitation
> :)

Patch 5 does that.

However, I suspect most of the gain comes from
not having mprotect and madvise send IPIs to
lazy TLB mode CPUs at all any more :)

--
All Rights Reversed.[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2018-06-22 17:17    [W:1.286 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site