[RFC PATCH v1 2/4] riscv: mm: Introduce percpu tlb flush queue
Xu Lu
luxu.kernel at bytedance.com
Thu Oct 30 06:56:50 PDT 2025
The percpu tlb flush queue is used to buffer the tlb flush tasks that
each cpu needs to process.
Signed-off-by: Xu Lu <luxu.kernel at bytedance.com>
---
arch/riscv/mm/tlbflush.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/riscv/mm/tlbflush.c b/arch/riscv/mm/tlbflush.c
index 8404530ec00f9..aa8f1304ae5c4 100644
--- a/arch/riscv/mm/tlbflush.c
+++ b/arch/riscv/mm/tlbflush.c
@@ -103,6 +103,18 @@ struct flush_tlb_range_data {
unsigned long stride;
};
+#define TLB_FLUSH_QUEUE_SIZE 16
+struct tlb_flush_queue {
+ struct flush_tlb_range_data tasks[TLB_FLUSH_QUEUE_SIZE];
+ raw_spinlock_t lock;
+ unsigned int len;
+};
+
+DEFINE_PER_CPU(struct tlb_flush_queue, tlb_flush_queue) = {
+ .lock = __RAW_SPIN_LOCK_UNLOCKED(tlb_flush_queue.lock),
+ .len = 0,
+};
+
static void __ipi_flush_tlb_range_asid(void *info)
{
struct flush_tlb_range_data *d = info;
--
2.20.1
More information about the linux-riscv
mailing list