[PATCH v3 4/5] x86/mm: Initialize kernel TLB flush requests directly
From: Chuyi Zhou
Date: Sun Oct 11 2026 - 23:44:47 EST
flush_tlb_kernel_range() uses init_flush_tlb_info(), which records
initiating_cpu with smp_processor_id(). The kernel flush callbacks do
not use this field, but initializing it in a preemptible context would
trigger the CPU-pinning check.
Prepare for allowing preemption during the IPI completion wait by
initializing start and end directly in struct flush_tlb_info and using
the shared threshold predicate to select full or range flushes. Keep the
outer preemption guard unchanged.
Signed-off-by: Chuyi Zhou <zhouchuyi@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/20260522104818.CbT5fyN8@xxxxxxxxxxxxx/
---
arch/x86/mm/tlb.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 0d03011c6825..2213f1a6f9e1 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -1504,13 +1504,14 @@ static void kernel_tlb_flush_range(struct flush_tlb_info *info)
void flush_tlb_kernel_range(unsigned long start, unsigned long end)
{
- struct flush_tlb_info info;
+ struct flush_tlb_info info = {
+ .start = start,
+ .end = end,
+ };
guard(preempt)();
- init_flush_tlb_info(&info, NULL, start, end, PAGE_SHIFT, false,
- TLB_GENERATION_INVALID);
- if (info.end == TLB_FLUSH_ALL)
+ if (tlb_range_exceeds_ceiling(start, end, PAGE_SHIFT))
flush_tlb_all();
else
kernel_tlb_flush_range(&info);