KVM: Skip unnecessary "unmap" if gpc is already valid during refresh
authorSean Christopherson <seanjc@google.com>
Thu, 13 Oct 2022 21:12:32 +0000 (21:12 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 30 Nov 2022 19:25:24 +0000 (19:25 +0000)
When refreshing a gfn=>pfn cache, skip straight to unlocking if the cache
already valid instead of stuffing the "old" variables to turn the
unmapping outro into a nop.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
virt/kvm/pfncache.c

index a805cc1..2d6aba6 100644 (file)
@@ -301,9 +301,8 @@ static int __kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, gpa_t gpa,
                 * may have changed.
                 */
                gpc->khva = old_khva + page_offset;
-               old_pfn = KVM_PFN_ERR_FAULT;
-               old_khva = NULL;
                ret = 0;
+               goto out_unlock;
        }
 
  out: