[PATCH 1/5] x86/mm: Account for remote kernel TLB flush requests

From: Chuyi Zhou

Date: Mon Sep 21 2026 - 06:42:24 EST


NR_TLB_REMOTE_FLUSH counts requests to invalidate TLB entries on other
CPUs. flush_tlb_all() and native_flush_tlb_multi() account for these
requests, but flush_tlb_kernel_range() bypasses both functions and does
not update the counter. Kernel range flushes are therefore missing from
the sender-side statistics, including ranges promoted to a full flush.

Count each request in kernel_tlb_flush_all() and
kernel_tlb_flush_range(). Account for both IPI and INVLPGB backends, as
flush_tlb_all() already does, and count once per request regardless of
the number of target CPUs or invalidation instructions.

Signed-off-by: Chuyi Zhou <zhouchuyi@xxxxxxxxxxxxx>
---
arch/x86/mm/tlb.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 0c4da320831c..da7c408f921c 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -1488,6 +1488,8 @@ static void do_kernel_range_flush(void *info)

static void kernel_tlb_flush_all(struct flush_tlb_info *info)
{
+ count_vm_tlb_event(NR_TLB_REMOTE_FLUSH);
+
if (cpu_feature_enabled(X86_FEATURE_INVLPGB))
invlpgb_flush_all();
else
@@ -1496,6 +1498,8 @@ static void kernel_tlb_flush_all(struct flush_tlb_info *info)

static void kernel_tlb_flush_range(struct flush_tlb_info *info)
{
+ count_vm_tlb_event(NR_TLB_REMOTE_FLUSH);
+
if (cpu_feature_enabled(X86_FEATURE_INVLPGB))
invlpgb_kernel_range_flush(info);
else

base-commit: e81ee06308379a5f2ededf997bcf17551bce5db7
--
2.20.1