Re: [RFC PATCH 1/2] x86/mm/tlb: Skip batch->cpumask updates when X86_FEATURE_INVLPGB is enabled

From: Rik van Riel

Date: Tue Dec 01 2026 - 22:37:28 EST


On Tue, 2026-11-03 at 01:26 +0000, Bing Jiao wrote:
> Commit 72a920eacd8a ("x86/mm: Use broadcast TLB flushing in page
> reclaim")
> and commit 0b7eb55cb706 ("x86/mm: Only do broadcast flush from
> reclaim if
> pages were unmapped") changed arch_tlbbatch_flush() to flush all
> non-global TLB entries via invlpgb_flush_all_nonglobals() when
> X86_FEATURE_INVLPGB is enabled.
>
> However, arch_tlbbatch_add_pending() still unconditionally ORs
> mm_cpumask(mm) into batch->cpumask on every unmapped page even when
> X86_FEATURE_INVLPGB is enabled.
>
> Guard the batch->cpumask update in arch_tlbbatch_add_pending() with
> !cpu_feature_enabled(X86_FEATURE_INVLPGB) to avoid unnecessary bitmap
> operations on every unmapped page.
>
> Signed-off-by: Bing Jiao <bingjiao@xxxxxxxxxx>
>

Reviewed-by: Rik van Riel <riel@xxxxxxxxxxx>

--
All Rights Reversed.