Re: [PATCH 4/7] x86,tlb: make lazy TLB mode lazier

From: Peter Zijlstra
Date: Fri Jul 20 2018 - 07:04:39 EST


On Fri, Jul 20, 2018 at 11:32:39AM +0200, Peter Zijlstra wrote:

> + if (!next->mm) { // to kernel
> + enter_lazy_tlb(prev->active_mm, next);
> +
> +#ifdef ARCH_NO_ACTIVE_MM
> + next->active_mm = prev->active_mm;
> + if (prev->mm) // from user
> + mmgrab(prev->active_mm);
else
prev->active_mm = NULL;
> +#endif
> + } else { // to user
> + switch_mm_irqs_off(prev->active_mm, next->mm, next);
> +
> +#ifdef ARCH_NO_ACTIVE_MM
> + if (!prev->mm) { // from kernel
> + /* will mmdrop() in finish_task_switch(). */
> + rq->prev_mm = prev->active_mm;
> + prev->active_mm = NULL;
> + }
> +#endif
> }