Re: [PATCH 3/5] KVM: ensure pool time is longer than block_ns

From: Paolo Bonzini
Date: Mon Nov 11 2019 - 08:54:01 EST


On 01/11/19 22:16, Marcelo Tosatti wrote:
> if (!vcpu_valid_wakeup(vcpu)) {
> shrink_halt_poll_ns(vcpu);
> } else if (halt_poll_ns) {
> - if (block_ns <= vcpu->halt_poll_ns)
> + if (block_ns < vcpu->halt_poll_ns)
> ;
> /* we had a short halt and our poll time is too small */
> else if (block_ns < halt_poll_ns)

What about making this "if (!waited)"? The result would be very readable:

if (!waited)
;
/* we had a long block, shrink polling */
else if (block_ns > halt_poll_ns && vcpu->halt_poll_ns)
shrink_halt_poll_ns(vcpu);
/* we had a short halt and our poll time is too small */
else if (block_ns < halt_poll_ns && vcpu->halt_poll_ns < halt_poll_ns)
grow_halt_poll_ns(vcpu);

Paolo