Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v1 0/4] riscv: mm: Defer tlb flush to context_switch
@ 2025-10-30 13:56 Xu Lu
  2025-10-30 13:56 ` [RFC PATCH v1 1/4] riscv: mm: Introduce percpu loaded_asid Xu Lu
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Xu Lu @ 2025-10-30 13:56 UTC (permalink / raw)
  To: pjw, palmer, aou, alex, apatel, guoren; +Cc: linux-riscv, linux-kernel, Xu Lu

When need to flush tlb of a remote cpu, there is no need to send an IPI
if the target cpu is not using the asid we want to flush. Instead, we
can cache the tlb flush info in percpu buffer, and defer the tlb flush
to the next context_switch.

This reduces the number of IPI due to tlb flush:

* ltp - mmapstress01
Before: ~108k
After: ~46k

Future plan in the next version:

- This patch series reduces IPI by deferring tlb flush to
context_switch. It does not clear the mm_cpumask of target mm_struct. In
the next version, I will apply a threshold to the number of ASIDs
maintained by each cpu's tlb. Once the threshold is exceeded, ASID that
has not been used for the longest time will be flushed out. And current
cpu will be cleared in the mm_cpumask.

Thanks in advance for your comments.

Xu Lu (4):
  riscv: mm: Introduce percpu loaded_asid
  riscv: mm: Introduce percpu tlb flush queue
  riscv: mm: Enqueue tlbflush info if task is not running on target cpu
  riscv: mm: Perform tlb flush during context_switch

 arch/riscv/include/asm/mmu_context.h |  1 +
 arch/riscv/include/asm/tlbflush.h    |  4 ++
 arch/riscv/mm/context.c              | 10 ++++
 arch/riscv/mm/tlbflush.c             | 76 +++++++++++++++++++++++++++-
 4 files changed, 90 insertions(+), 1 deletion(-)

-- 
2.20.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-11-07  3:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 13:56 [RFC PATCH v1 0/4] riscv: mm: Defer tlb flush to context_switch Xu Lu
2025-10-30 13:56 ` [RFC PATCH v1 1/4] riscv: mm: Introduce percpu loaded_asid Xu Lu
2025-10-30 13:56 ` [RFC PATCH v1 2/4] riscv: mm: Introduce percpu tlb flush queue Xu Lu
2025-10-30 13:56 ` [RFC PATCH v1 3/4] riscv: mm: Enqueue tlbflush info if task is not running on target cpu Xu Lu
2025-10-30 13:56 ` [RFC PATCH v1 4/4] riscv: mm: Perform tlb flush during context_switch Xu Lu
2025-11-03  3:44   ` Guo Ren
2025-11-03  3:44 ` [RFC PATCH v1 0/4] riscv: mm: Defer tlb flush to context_switch Guo Ren
2025-11-03  7:06   ` [External] " Xu Lu
2025-11-07  1:55 ` Guo Ren
2025-11-07  3:03   ` [External] " Xu Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox