[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <667c6fd5-2ab9-d3ca-0791-3d270de98204@linux.intel.com>
Date: Fri, 29 Jun 2018 10:05:15 -0700
From: Dave Hansen <dave.hansen@...ux.intel.com>
To: Rik van Riel <riel@...riel.com>, linux-kernel@...r.kernel.org
Cc: x86@...nel.org, luto@...nel.org, mingo@...nel.org,
kernel-team@...com, tglx@...utronix.de, efault@....de,
songliubraving@...com, hpa@...or.com
Subject: Re: [PATCH 4/7] x86,tlb: make lazy TLB mode lazier
On 06/29/2018 07:29 AM, Rik van Riel wrote:
> + /*
> + * If the CPU is not in lazy TLB mode, we are just switching
> + * from one thread in a process to another thread in the same
> + * process. No TLB flush required.
> + */
> + if (!was_lazy)
> + return;
> +
> + /*
> + * Read the tlb_gen to check whether a flush is needed.
> + * If the TLB is up to date, just use it.
> + * The barrier synchronizes with the tlb_gen increment in
> + * the TLB shootdown code.
> + */
> + smp_mb();
> + next_tlb_gen = atomic64_read(&next->context.tlb_gen);
> + if (this_cpu_read(cpu_tlbstate.ctxs[prev_asid].tlb_gen) ==
> + next_tlb_gen)
> + return;
Nit: it might be nice to have this hunk in a helper like
cpu_tlbstate_needs_flush(next) to keep this nice and readable.
Powered by blists - more mailing lists