riscv: mm: Always use an ASID to flush mm contexts
authorSamuel Holland <samuel.holland@sifive.com>
Wed, 27 Mar 2024 04:49:54 +0000 (21:49 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Mon, 29 Apr 2024 17:49:36 +0000 (10:49 -0700)
Even if multiple ASIDs are not supported, using the single-ASID variant
of the sfence.vma instruction preserves TLB entries for global (kernel)
pages. So it is always more efficient to use the single-ASID code path.

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://lore.kernel.org/r/20240327045035.368512-14-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/mm/tlbflush.c

index 35266dd9a9a2cca5a9a8b7780d6659eb74456d10..44e7ed4e194f8f0cd7635f2917c99de4ec02976c 100644 (file)
@@ -109,8 +109,7 @@ static void __flush_tlb_range(struct cpumask *cmask, unsigned long asid,
 
 static inline unsigned long get_mm_asid(struct mm_struct *mm)
 {
-       return static_branch_unlikely(&use_asid_allocator) ?
-                       cntx2asid(atomic_long_read(&mm->context.id)) : FLUSH_TLB_NO_ASID;
+       return cntx2asid(atomic_long_read(&mm->context.id));
 }
 
 void flush_tlb_mm(struct mm_struct *mm)