OSDN Git Service

KVM: try __get_user_pages_fast even if not in atomic context
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 27 Jul 2018 15:44:41 +0000 (17:44 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 6 Aug 2018 15:59:07 +0000 (17:59 +0200)
commitb9b33da2aa7429b0f61bcd218d34e1a277459fb4
treee96543535148bb56df1d33bcfdd4886108005121
parent877ad952be3d51445f6a74dd63708a9327c8f19d
KVM: try __get_user_pages_fast even if not in atomic context

We are currently cutting hva_to_pfn_fast short if we do not want an
immediate exit, which is represented by !async && !atomic.  However,
this is unnecessary, and __get_user_pages_fast is *much* faster
because the regular get_user_pages takes pmd_lock/pte_lock.
In fact, when many CPUs take a nested vmexit at the same time
the contention on those locks is visible, and this patch removes
about 25% (compared to 4.18) from vmexit.flat on a 16 vCPU
nested guest.

Suggested-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c