summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJinyu Tang <tjytimi@163.com>2026-04-12 05:38:22 +0300
committerAnup Patel <anup@brainfault.org>2026-05-31 18:25:35 +0300
commit60aa6734f542a6c4b63cfbaabc544c3e67412ce9 (patch)
tree59d41f7a31bb2e64e903914452823c8afb7bff70 /scripts
parent11a713db4394a0ec61f9b9bda056363e45ff1961 (diff)
downloadlinux-60aa6734f542a6c4b63cfbaabc544c3e67412ce9.tar.xz
RISC-V: KVM: Batch stage-2 TLB flushes
KVM RISC-V triggers a TLB flush for every single stage-2 PTE modification (unmap or write-protect) now. Although KVM coalesces the hardware IPIs, the software overhead of executing the flush work for every page is large, especially during dirty page tracking. Following the approach used in x86 and arm64, this patch optimizes the MMU logic by making the PTE manipulation functions return a boolean indicating if a leaf PTE was actually changed. The outer MMU functions bubble up this flag to batch the remote TLB flushes. Consequently, the flush operation is executed only once per batch. Moving it outside of the `mmu_lock` also reduces lock contention. Tested with tools/testing/selftests/kvm on a 4-vCPU guest (Host environment: QEMU 10.2.1 RISC-V) 1. demand_paging_test (1GB memory) time ./demand_paging_test -b 1G -v 4 - Total execution time reduced from ~2m39s to ~2m31s 2. dirty_log_perf_test (1GB memory) ./dirty_log_perf_test -b 1G -v 4 - "Clear dirty log time" per iteration dropped significantly from ~3.40s to ~0.18s Reviewed-by: Nutty Liu <nutty.liu@hotmail.com> Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Jinyu Tang <tjytimi@163.com> Link: https://lore.kernel.org/r/20260412023822.83341-1-tjytimi@163.com Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions