mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-28 12:35:22 +08:00
KVM: Don't redo ktime_get() when calculating halt-polling stop/deadline
Calculate the halt-polling "stop" time using "start" instead of redoing ktime_get(). In practice, the numbers involved are in the noise (e.g., in the happy case where hardware correctly predicts do_halt_poll and there are no interrupts, "start" is probably only a few cycles old) and either approach is perfectly ok. But it's more precise to count any extra latency toward the halt-polling time. Reviewed-by: David Matlack <dmatlack@google.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20211009021236.4122790-17-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c3858335c7
commit
109a98260b
@ -3343,7 +3343,7 @@ void kvm_vcpu_halt(struct kvm_vcpu *vcpu)
|
|||||||
|
|
||||||
start = cur = poll_end = ktime_get();
|
start = cur = poll_end = ktime_get();
|
||||||
if (do_halt_poll) {
|
if (do_halt_poll) {
|
||||||
ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);
|
ktime_t stop = ktime_add_ns(start, vcpu->halt_poll_ns);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user