Skip to content

Commit

Permalink
KVM: VMX: Avoid unnecessary vcpu_load()/vcpu_put() cycles
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yaozu Dong authored and Avi Kivity committed May 3, 2007
1 parent d6c69ee commit 3fca036
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3fca036

Please sign in to comment.