lkml.org 
[lkml]   [2018]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 1/2] x86/ibpb: Skip IBPB when we switch back to same user process
From
Date
On 01/25/2018 11:34 AM, Arjan van de Ven wrote:
>> This patch tries to address the case when we do switch to init_mm
>> and back. Do you still have objections to the approach in this
>> patch to save the last active mm before switching to init_mm?
>
> how do you know the last active mm did not go away and started a new
> process with new content?
> (other than taking a reference which has other side effects)

We couldn't think of an easy way to prevent mm reuse other than taking a
reference. Think of it this way: the mm getting run poisons a CPU. We
can either go at exit() time and do IBPB on every CPU that might have
poison from the mm. Or, we do IBPB once on each CPU the first time the
mm runs there to make sure that no old poison is still around.

Both of those require per-cpu state in the mm, kinda like the TLB
tracking. That will not be fun to get right. It also adds overhead to
the common-case exit() or fork() paths. Also not fun.

The refcount just eats a little memory for the mm *itself* but none of
the actual expensive stuff: VMAs or page tables that hang off the mm.
It's also zero-cost at fork/exit. The going-to-idle cost is manageable
and *certainly* outweighs the cost of even one extra IBPB that we would
otherwise have to do.

\
 
 \ /
  Last update: 2018-01-25 20:45    [W:0.062 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site