Re: [tip:x86/mm] x86/mm/tlb: Only send page table free TLB flush to lazy TLB CPUs

From: Peter Zijlstra
Date: Wed Jul 18 2018 - 12:20:03 EST


On Wed, Jul 18, 2018 at 11:50:33AM -0400, Rik van Riel wrote:
> > On Jul 18, 2018, at 11:42 AM, Rik van Riel <riel@xxxxxxxxxxx> wrote:
> >> On Jul 17, 2018, at 7:39 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx <mailto:peterz@xxxxxxxxxxxxx>> wrote:

> >> Also, was there a reason to re-implement on_each_cpu_cond() ? (which btw
> >> also wants that __cpumask_set_bit fix).
> >
> > I did not use on_each_cpu_cond() because I had no idea it
> > existed. A quick grep suggests very few users of that function :)

Yeah, only reason I know it existed was because I helped write it or
something like that :-)

> > I'll make sure things are done the right way.
> >
> OK, looking at it some more, I think open coding may be faster in
> case of the TLB shootdown code, because that way we only iterate
> over the CPUs in the mm_cpumask, instead of iterating over every
> single online CPU in the system, and calling the helper function for
> every CPU, like on_each_cpu_cond() does.
>
> However, the difference in overhead might be small enough that
> we might not notice. Preferences?

Yeah, so the difference is the case where the mask allocation fails; in
that case we're under severe memory pressure and performance sucks
anyway, right?

In which case using on_each_cpu_cond() seems the simpler option.