public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] KVM: more halt polling
@ 2016-05-17  8:49 Christian Borntraeger
  2016-05-17  8:49 ` [PATCH 1/1] KVM: shrink halt polling even more for invalid wakeups Christian Borntraeger
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2016-05-17  8:49 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář
  Cc: KVM, Cornelia Huck, linux-s390, Christian Borntraeger,
	David Matlack, Wanpeng Li

Paolo, Radim,

looks like I messed up. While performance showed variant 2 to be
better (very aggressive shrinking) I send you variant 1 last week.

Please consider this addon patch to improve the halt polling for
s390 even further. (variant 1 is still better than the situation
before, so not a big issue, but still).



Christian Borntraeger (1):
  KVM: shrink halt polling even more for invalid wakeups

 virt/kvm/kvm_main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
2.5.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] KVM: shrink halt polling even more for invalid wakeups
  2016-05-17  8:49 [PATCH 0/1] KVM: more halt polling Christian Borntraeger
@ 2016-05-17  8:49 ` Christian Borntraeger
  2016-05-17 13:54   ` Christian Borntraeger
  2016-05-17 17:00   ` Cornelia Huck
  0 siblings, 2 replies; 5+ messages in thread
From: Christian Borntraeger @ 2016-05-17  8:49 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář
  Cc: KVM, Cornelia Huck, linux-s390, Christian Borntraeger,
	David Matlack, Wanpeng Li

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 <= 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.

Cc: David Matlack <dmatlack@google.com>
Cc: Wanpeng Li <kernellwp@gmail.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 virt/kvm/kvm_main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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 = ktime_to_ns(cur) - ktime_to_ns(start);
 
-	if (halt_poll_ns) {
+	if (!vcpu_valid_wakeup(vcpu))
+		 shrink_halt_poll_ns(vcpu);
+	else if (halt_poll_ns) {
 		if (block_ns <= 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 &&
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] KVM: shrink halt polling even more for invalid wakeups
  2016-05-17  8:49 ` [PATCH 1/1] KVM: shrink halt polling even more for invalid wakeups Christian Borntraeger
@ 2016-05-17 13:54   ` Christian Borntraeger
  2016-05-17 16:43     ` Paolo Bonzini
  2016-05-17 17:00   ` Cornelia Huck
  1 sibling, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2016-05-17 13:54 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář
  Cc: KVM, Cornelia Huck, linux-s390, David Matlack, Wanpeng Li

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 <= 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.
> 
> Cc: David Matlack <dmatlack@google.com>
> Cc: Wanpeng Li <kernellwp@gmail.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  virt/kvm/kvm_main.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> 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 = ktime_to_ns(cur) - ktime_to_ns(start);
> 
> -	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 <= 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 &&
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] KVM: shrink halt polling even more for invalid wakeups
  2016-05-17 13:54   ` Christian Borntraeger
@ 2016-05-17 16:43     ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2016-05-17 16:43 UTC (permalink / raw)
  To: Christian Borntraeger, Radim Krčmář
  Cc: KVM, Cornelia Huck, linux-s390, David Matlack, Wanpeng Li



On 17/05/2016 15:54, Christian Borntraeger wrote:
>> > -	if (halt_poll_ns) {
>> > +	if (!vcpu_valid_wakeup(vcpu))
>> > +		 shrink_halt_poll_ns(vcpu);
> 		^ hmpf. Small whitespace error. I can resend if wanted.

No need.

Paolo

>> > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] KVM: shrink halt polling even more for invalid wakeups
  2016-05-17  8:49 ` [PATCH 1/1] KVM: shrink halt polling even more for invalid wakeups Christian Borntraeger
  2016-05-17 13:54   ` Christian Borntraeger
@ 2016-05-17 17:00   ` Cornelia Huck
  1 sibling, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2016-05-17 17:00 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Paolo Bonzini, Radim Krčmář, KVM, linux-s390,
	David Matlack, Wanpeng Li

On Tue, 17 May 2016 10:49:22 +0200
Christian Borntraeger <borntraeger@de.ibm.com> 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 <= 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.
> 
> Cc: David Matlack <dmatlack@google.com>
> Cc: Wanpeng Li <kernellwp@gmail.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  virt/kvm/kvm_main.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-17 17:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17  8:49 [PATCH 0/1] KVM: more halt polling Christian Borntraeger
2016-05-17  8:49 ` [PATCH 1/1] KVM: shrink halt polling even more for invalid wakeups Christian Borntraeger
2016-05-17 13:54   ` Christian Borntraeger
2016-05-17 16:43     ` Paolo Bonzini
2016-05-17 17:00   ` Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox