]> www.infradead.org Git - users/dwmw2/linux.git/commit
riscv: Make __flush_tlb_range() loop over pte instead of flushing the whole tlb
authorAlexandre Ghiti <alexghiti@rivosinc.com>
Mon, 30 Oct 2023 13:30:27 +0000 (14:30 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Tue, 7 Nov 2023 06:49:21 +0000 (22:49 -0800)
commitba6f35964c518b4520bc3f2fe25d8457cb4a7be5
tree8a226c57168141fb4684e6f32aa451326a1e7bca
parent9e113064b4c291ad06a7a3864691288bd2cf014f
riscv: Make __flush_tlb_range() loop over pte instead of flushing the whole tlb

Currently, when the range to flush covers more than one page (a 4K page or
a hugepage), __flush_tlb_range() flushes the whole tlb. Flushing the whole
tlb comes with a greater cost than flushing a single entry so we should
flush single entries up to a certain threshold so that:
threshold * cost of flushing a single entry < cost of flushing the whole
tlb.

Co-developed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # On RZ/Five SMARC
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Tested-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://lore.kernel.org/r/20231030133027.19542-4-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/sbi.h
arch/riscv/include/asm/tlbflush.h
arch/riscv/kernel/sbi.c
arch/riscv/mm/tlbflush.c