KVM: Use cond_resched() directly and remove useless kvm_resched()
authorTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Fri, 13 Dec 2013 06:07:21 +0000 (15:07 +0900)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 13 Dec 2013 13:23:45 +0000 (14:23 +0100)
Since the commit 15ad7146 ("KVM: Use the scheduler preemption notifiers
to make kvm preemptible"), the remaining stuff in this function is a
simple cond_resched() call with an extra need_resched() check which was
there to avoid dropping VCPUs unnecessarily.  Now it is meaningless.

Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/ia64/kvm/kvm-ia64.c
arch/powerpc/kvm/book3s_hv.c
arch/x86/kvm/x86.c
include/linux/kvm_host.h
virt/kvm/kvm_main.c

index 985bf80c622e6dea757f16e75cb5004210196cd3..53f44bee9ebb2cc1efcb4c46b0549b5cfd9a4a48 100644 (file)
@@ -702,7 +702,7 @@ again:
 out:
        srcu_read_unlock(&vcpu->kvm->srcu, idx);
        if (r > 0) {
-               kvm_resched(vcpu);
+               cond_resched();
                idx = srcu_read_lock(&vcpu->kvm->srcu);
                goto again;
        }
index 072287f1c3bc7347b6ff4f959843c97053fa4aa1..3fa99b20894f3ee54cdc4b83f6743b31377c16c8 100644 (file)
@@ -1348,7 +1348,7 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
        kvm_guest_exit();
 
        preempt_enable();
-       kvm_resched(vcpu);
+       cond_resched();
 
        spin_lock(&vc->lock);
        now = get_tb();
index 21ef1ba184ae8500a70061f566ea55fde76cbfd2..4fb1ee619c1c286d050236e0637eb6b80f78c0f4 100644 (file)
@@ -6125,7 +6125,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
                }
                if (need_resched()) {
                        srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
-                       kvm_resched(vcpu);
+                       cond_resched();
                        vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
                }
        }
index 9523d2ad7535c42be6881ee882b95f8ce1efad9a..4ecf10775c4f9b4fe72ae0b74ff6c0cd5eac9a53 100644 (file)
@@ -583,7 +583,6 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu);
 void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
 bool kvm_vcpu_yield_to(struct kvm_vcpu *target);
 void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu);
-void kvm_resched(struct kvm_vcpu *vcpu);
 void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
 void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
 
index a0aa84b5941ac96aabae48b03d80278052ce8929..03c97e7ae4ca8f534479bff27ecade0616e94900 100644 (file)
@@ -1710,14 +1710,6 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
 EXPORT_SYMBOL_GPL(kvm_vcpu_kick);
 #endif /* !CONFIG_S390 */
 
-void kvm_resched(struct kvm_vcpu *vcpu)
-{
-       if (!need_resched())
-               return;
-       cond_resched();
-}
-EXPORT_SYMBOL_GPL(kvm_resched);
-
 bool kvm_vcpu_yield_to(struct kvm_vcpu *target)
 {
        struct pid *pid;