[PATCH v2 2/5] x86/mm: Share the full TLB flush dispatch
From: Chuyi Zhou
Date: Mon Oct 05 2026 - 01:58:25 EST
flush_tlb_all() and kernel_tlb_flush_all() select the same INVLPGB or
IPI backend and account for the same sender-side event. Keeping two
implementations duplicates the backend selection and accounting.
Use flush_tlb_all() for kernel ranges promoted to a full flush and
remove kernel_tlb_flush_all(). Share the existing backend dispatch and
event accounting so each request is counted once.
Signed-off-by: Chuyi Zhou <zhouchuyi@xxxxxxxxxxxxx>
---
arch/x86/mm/tlb.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index da7c408f921c..5a1b96c61050 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -1486,16 +1486,6 @@ static void do_kernel_range_flush(void *info)
flush_tlb_one_kernel(addr);
}
-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
- on_each_cpu(do_flush_tlb_all, NULL, 1);
-}
-
static void kernel_tlb_flush_range(struct flush_tlb_info *info)
{
count_vm_tlb_event(NR_TLB_REMOTE_FLUSH);
@@ -1515,7 +1505,7 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end)
TLB_GENERATION_INVALID);
if (info.end == TLB_FLUSH_ALL)
- kernel_tlb_flush_all(&info);
+ flush_tlb_all();
else
kernel_tlb_flush_range(&info);
}
--
2.20.1