Re: [PATCH] x86,switch_mm: skip atomic operations for init_mm

From: Rik van Riel
Date: Fri Jun 01 2018 - 16:35:42 EST

On Fri, 2018-06-01 at 13:03 -0700, Andy Lutomirski wrote:
> Mike, you never did say: do you have PCID on your CPU? Also, what is
> your workload doing to cause so many switches back and forth between
> init_mm and a task.
> The point of the optimization is that switching to init_mm() should
> be
> fairly fast on a PCID system, whereas an IPI to do the deferred flush
> is very expensive regardless of PCID.

While I am sure that bit is true, Song and I
observed about 4x as much CPU use in the atomic
operations in cpumask_clear_cpu and cpumask_set_cpu
(inside switch_mm_irqs_off) as we saw CPU used
in the %cr3 reload itself.

Given how expensive those cpumask updates are,
lazy TLB mode might always be worth it, especially
on larger systems.

All Rights Reversed.

Attachment: signature.asc
Description: This is a digitally signed message part