diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 2fed9a9b8bd688367123c393dc4ea068e67f4afc..5a2643c5a8ec831ec0c353b4b7fdb5580601edf9 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -6317,7 +6317,7 @@ static void kvm_sched_out(struct preempt_notifier *pn, WRITE_ONCE(vcpu->scheduled_out, true); - if (current->on_rq) { + if (current->on_rq && vcpu->wants_to_run) { WRITE_ONCE(vcpu->preempted, true); WRITE_ONCE(vcpu->ready, true); }