From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [PATCH 1/1] KVM: shrink halt polling even more for invalid wakeups Date: Tue, 17 May 2016 15:54:34 +0200 Message-ID: <573B229A.3050608@de.ibm.com> References: <1463474962-5941-1-git-send-email-borntraeger@de.ibm.com> <1463474962-5941-2-git-send-email-borntraeger@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: KVM , Cornelia Huck , linux-s390 , David Matlack , Wanpeng Li To: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:40381 "EHLO e06smtp13.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751039AbcEQNyl (ORCPT ); Tue, 17 May 2016 09:54:41 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 May 2016 14:54:39 +0100 In-Reply-To: <1463474962-5941-2-git-send-email-borntraeger@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/17/2016 10:49 AM, Christian Borntraeger wrote: > commit 3491caf2755e ("KVM: halt_polling: provide a way to qualify > wakeups during poll") added more aggressive shrinking of the > polling interval if the wakeup did not match some criteria. This > still allows to keep polling enabled if the polling time was > smaller that the current max poll time (block_ns <=3D vcpu->halt_poll= _ns). > Performance measurement shows that even more aggressive shrinking > (shrink polling on any invalid wakeup) reduces absolute and relative > (to the workload) CPU usage even further. >=20 > Cc: David Matlack > Cc: Wanpeng Li > Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 > CC: Paolo Bonzini > CC: Cornelia Huck > Signed-off-by: Christian Borntraeger > --- > virt/kvm/kvm_main.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index fbd7698..dec1ed2 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -2055,12 +2055,13 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > out: > block_ns =3D ktime_to_ns(cur) - ktime_to_ns(start); >=20 > - if (halt_poll_ns) { > + if (!vcpu_valid_wakeup(vcpu)) > + shrink_halt_poll_ns(vcpu); ^ hmpf. Small whitespace error. I can resend if wanted. > + else if (halt_poll_ns) { > if (block_ns <=3D vcpu->halt_poll_ns) > ; > /* we had a long block, shrink polling */ > - else if (!vcpu_valid_wakeup(vcpu) || > - (vcpu->halt_poll_ns && block_ns > halt_poll_ns)) > + else if (vcpu->halt_poll_ns && block_ns > halt_poll_ns) > shrink_halt_poll_ns(vcpu); > /* we had a short halt and our poll time is too small */ > else if (vcpu->halt_poll_ns < halt_poll_ns && >=20