mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
KVM: VMX: Avoid unnecessary vcpu_load()/vcpu_put() cycles
By checking if a reschedule is needed, we avoid dropping the vcpu. [With changes by me, based on Anthony Liguori's observations] Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
parent
d6c69ee9a2
commit
3fca036530
1 changed files with 2 additions and 0 deletions
|
@ -1590,6 +1590,8 @@ static int set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
|
|||
|
||||
void kvm_resched(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
if (!need_resched())
|
||||
return;
|
||||
vcpu_put(vcpu);
|
||||
cond_resched();
|
||||
vcpu_load(vcpu);
|
||||
|
|
Loading…
Reference in a new issue