lkml.org 
[lkml]   [2018]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] x86,switch_mm: skip atomic operations for init_mm
From
Date
On Fri, 2018-06-01 at 08:11 -0700, Andy Lutomirski wrote:
> On Fri, Jun 1, 2018 at 5:28 AM Rik van Riel <riel@surriel.com> wrote:
> >
> > Song noticed switch_mm_irqs_off taking a lot of CPU time in recent
> > kernels,using 2.4% of a 48 CPU system during a netperf to localhost
> > run.
> > Digging into the profile, we noticed that cpumask_clear_cpu and
> > cpumask_set_cpu together take about half of the CPU time taken by
> > switch_mm_irqs_off.
> >
> > However, the CPUs running netperf end up switching back and forth
> > between netperf and the idle task, which does not require changes
> > to the mm_cpumask. Furthermore, the init_mm cpumask ends up being
> > the most heavily contended one in the system.`
> >
> > Skipping cpumask_clear_cpu and cpumask_set_cpu for init_mm
> > (mostly the idle task) reduced CPU use of switch_mm_irqs_off
> > from 2.4% of the CPU to 1.9% of the CPU, with the following
> > netperf commandline:
>
> I'm conceptually fine with this change. Does mm_cpumask(&init_mm)
> end
> up in a deterministic state?

Given that we do not touch mm_cpumask(&init_mm)
any more, and that bitmask never appears to be
used for things like tlb shootdowns (kernel TLB
shootdowns simply go to everybody), I suspect
it ends up in whatever state it is initialized
to on startup.

I had not looked into this much, because it does
not appear to be used for anything.

> Mike, depending on exactly what's going on with your benchmark, this
> might help recover a bit of your performance, too.

It will be interesting to know how this change
impacts others.

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