]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: pfncache: check the need for invalidation under read lock first
authorPaul Durrant <pdurrant@amazon.com>
Mon, 4 Dec 2023 10:41:39 +0000 (10:41 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 15 Jan 2024 10:49:40 +0000 (10:49 +0000)
commit3f6986b59a9e0c83a194404f7ad433ecadf2f0ea
treeac0b5906332eb360442c21a83d45af95c6864bd9
parentfdef7389e9b6a2e899cebaddfeb28ea538e59c2b
KVM: pfncache: check the need for invalidation under read lock first

Taking a write lock on a pfncache will be disruptive if the cache is
heavily used (which only requires a read lock). Hence, in the MMU notifier
callback, take read locks on caches to check for a match; only taking a
write lock to actually perform an invalidation (after a another check).

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
---
Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
v10:
 - New in this version.
virt/kvm/pfncache.c