[PATCH 2/2] arm64: tlbflush: Reset active_cpu on ASID rollover
sk at gentwo.org
sk at gentwo.org
Tue Jun 9 14:34:33 PDT 2026
From: Sayali Kulkarni <sskulkarni at amperecomputing.com>
Once active_cpu flips to ACTIVE_CPU_MULTIPLE, it never resets, even if the process settles back to one CPU. Reset it to ACTIVE_CPU_NONE when a new ASID is assigned after rollover, since flush_context() already issued a global TLB flush at that point meaning no stale TLB entries exist on any CPU.
This gives processes a fresh chance at the local-only flush fast path after each ASID generation rollover.
Signed-off-by: Sayali Kulkarni <sskulkarni at amperecomputing.com>
---
arch/arm64/mm/context.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c
index f34ed78393e0..0c92cc8fb4cd 100644
--- a/arch/arm64/mm/context.c
+++ b/arch/arm64/mm/context.c
@@ -250,6 +250,7 @@ void check_and_switch_context(struct mm_struct *mm)
if (!asid_gen_match(asid)) {
asid = new_context(mm);
atomic64_set(&mm->context.id, asid);
+ WRITE_ONCE(mm->context.active_cpu, ACTIVE_CPU_NONE);
}
if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending))
@@ -321,6 +322,7 @@ unsigned long arm64_mm_context_get(struct mm_struct *mm)
*/
asid = new_context(mm);
atomic64_set(&mm->context.id, asid);
+ WRITE_ONCE(mm->context.active_cpu, ACTIVE_CPU_NONE);
}
nr_pinned_asids++;
--
2.47.3
More information about the linux-arm-kernel
mailing list