Re: [PATCH 07/12] x86/tlb: use INVLPGB in flush_tlb_all
From: Dave Hansen
Date: Mon Jan 06 2025 - 12:29:44 EST
On 12/30/24 09:53, Rik van Riel wrote:
> --- a/arch/x86/mm/tlb.c
> +++ b/arch/x86/mm/tlb.c
> @@ -1074,6 +1074,12 @@ static void do_flush_tlb_all(void *info)
> void flush_tlb_all(void)
> {
> count_vm_tlb_event(NR_TLB_REMOTE_FLUSH);
> + if (cpu_feature_enabled(X86_FEATURE_INVLPGB)) {
> + guard(preempt)();
> + invlpgb_flush_all();
> + tlbsync();
> + return;
> + }
After seeing a few of these, I'd really prefer that the preempt and
tlbsync() logic be hidden in the invlpgb_*() helper, or *a* helper at least.
This would be a lot easier on the eyes if it were something like:
flushed = invlpgb_flush_all();
if (flushed)
return;
or even:
if (cpu_feature_enabled(X86_FEATURE_INVLPGB)) {
invlpgb_flush_all();
return;
}