Re: [PATCH RFC v6] x86,mm,sched: make lazy TLB mode even lazier

From: Peter Zijlstra
Date: Fri Sep 09 2016 - 03:45:05 EST


On Thu, Sep 08, 2016 at 09:39:45PM -0700, Andy Lutomirski wrote:
> If they're busy threads, shouldn't the yield return immediately
> because the threads are still ready to run? Lazy TLB won't do much
> unless you get the kernel in some state where it's running in the
> context of a different kernel thread and hasn't switched to
> swapper_pg_dir. IIRC idle works like that, but you'd need to actually
> sleep to go idle.

Right, a task doing:

for (;;) sched_yield();

esp. when its the only runnable thread on the CPU, is a busy thread. It
will not enter switch_mm(), which was where the invalidate hook was
placed IIRC.