1
0
Fork 0

kvm: exit halt polling on need_resched() as well

commit 262de4102c upstream.

single_task_running() is usually more general than need_resched()
but CFS_BANDWIDTH throttling will use resched_task() when there
is just one task to get the task to block. This was causing
long-need_resched warnings and was likely allowing VMs to
overrun their quota when halt polling.

Signed-off-by: Ben Segall <bsegall@google.com>
Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org>
Message-Id: <20210429162233.116849-1-venkateshs@chromium.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
pull/345/head^2
Benjamin Segall 2021-04-29 16:22:34 +00:00 committed by Greg Kroah-Hartman
parent 970c978d05
commit ce76392523
1 changed files with 2 additions and 1 deletions

View File

@ -2797,7 +2797,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
goto out;
}
poll_end = cur = ktime_get();
} while (single_task_running() && ktime_before(cur, stop));
} while (single_task_running() && !need_resched() &&
ktime_before(cur, stop));
}
prepare_to_rcuwait(&vcpu->wait);