KVM: VMX: Only reload guest cr2 if different from host cr2
authorAvi Kivity <avi@redhat.com>
Tue, 16 Jun 2009 09:33:56 +0000 (12:33 +0300)
committerAvi Kivity <avi@redhat.com>
Thu, 10 Sep 2009 05:32:57 +0000 (08:32 +0300)
commitd3edefc0035669e8817d1d5c32ef03e882477323
tree7fde2dfa8f43e1619e0d31549e54fef4d19a374d
parent681405bfc73a2717ae9b03b2bad465b009106f31
KVM: VMX: Only reload guest cr2 if different from host cr2

cr2 changes only rarely, and writing it is expensive.  Avoid the costly cr2
writes by checking if it does not already hold the desired value.

Shaves 70 cycles off the vmexit latency.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/vmx.c