From: Raghavendra K T Date: Mon, 4 Mar 2013 18:02:27 +0000 (+0530) Subject: kvm: Iterate over only vcpus that are preempted X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=7bc7ae25b1438bb9fe1f176b951d758789847640;p=openwrt%2Fstaging%2Fblogic.git kvm: Iterate over only vcpus that are preempted This helps in filtering out the eligible candidates further and thus potentially helps in quickly allowing preempted lockholders to run. Note that if a vcpu was spinning during preemption we filter them by checking whether they are preempted due to pause loop exit. Reviewed-by: Chegu Vinod Reviewed-by: Marcelo Tosatti Signed-off-by: Raghavendra K T Signed-off-by: Gleb Natapov --- diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 470f2bc8205a..ff7154188b5f 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1768,6 +1768,8 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me) continue; } else if (pass && i > last_boosted_vcpu) break; + if (!ACCESS_ONCE(vcpu->preempted)) + continue; if (vcpu == me) continue; if (waitqueue_active(&vcpu->wq))