mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wanpeng Li <wanpeng.li@hotmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: David Matlack <dmatlack@google.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wanpeng Li <wanpeng.li@hotmail.com>
Subject: [PATCH v4 0/3] KVM: Dynamic Halt-Polling
Date: Thu, 27 Aug 2015 17:52:16 +0800	[thread overview]
Message-ID: <BLU437-SMTP37F331E727F970F8BE6182806F0@phx.gbl> (raw)

v3 -> v4:
 * bring back grow vcpu->halt_poll_ns when interrupt arrives and shrinks
   when idle VCPU is detected 

v2 -> v3:
 * grow/shrink vcpu->halt_poll_ns by *halt_poll_ns_grow or /halt_poll_ns_shrink
 * drop the macros and hard coding the numbers in the param definitions
 * update the comments "5-7 us"
 * remove halt_poll_ns_max and use halt_poll_ns as the max halt_poll_ns time,
   vcpu->halt_poll_ns start at zero
 * drop the wrappers 
 * move the grow/shrink logic before "out:" w/ "if (waited)"

v1 -> v2:
 * change kvm_vcpu_block to read halt_poll_ns from the vcpu instead of 
   the module parameter
 * use the shrink/grow matrix which is suggested by David
 * set halt_poll_ns_max to 2ms

There is a downside of halt_poll_ns since poll is still happen for idle 
VCPU which can waste cpu usage. This patchset add the ability to adjust 
halt_poll_ns dynamically, grows halt_poll_ns if an interrupt arrives and 
shrinks halt_poll_ns when idle VCPU is detected.

There are two new kernel parameters for changing the halt_poll_ns:
halt_poll_ns_grow and halt_poll_ns_shrink. 


Test w/ high cpu overcommit ratio, pin vCPUs, and the halt_poll_ns of 
halt-poll is the default 500000ns, the max halt_poll_ns of dynamic 
halt-poll is 2ms. Then watch the %C0 in the dump of Powertop tool.
The test method is almost from David.

+-----------------+----------------+-------------------+
|                 |                |                   |
|  w/o halt-poll  |  w/ halt-poll  | dynamic halt-poll |
+-----------------+----------------+-------------------+
|                 |                |                   |
|    ~0.9%        |    ~1.8%       |     ~1.2%         |
+-----------------+----------------+-------------------+
                                             
The always halt-poll will increase ~0.9% cpu usage for idle vCPUs and the 
dynamic halt-poll drop it to ~0.3% which means that reduce the 67% overhead 
introduced by always halt-poll.

Wanpeng Li (3):
  KVM: make halt_poll_ns per-VCPU
  KVM: dynamic halt_poll_ns adjustment
  KVM: trace kvm_halt_poll_ns grow/shrink

 include/linux/kvm_host.h   |  1 +
 include/trace/events/kvm.h | 30 ++++++++++++++++++++++++++++
 virt/kvm/kvm_main.c        | 50 +++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 78 insertions(+), 3 deletions(-)
-- 
1.9.1


             reply	other threads:[~2015-08-27  9:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27  9:52 Wanpeng Li [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-08-27  9:47 Wanpeng Li
     [not found] ` <55E221B2.3000702@kieser.ca>
2015-08-29 22:21   ` Wanpeng Li
2015-08-29 22:26     ` Peter Kieser
2015-08-29 23:55       ` Wanpeng Li
2015-08-30  0:13         ` Peter Kieser
2015-08-30  0:21           ` Wanpeng Li
2015-08-31  7:44       ` Wanpeng Li
2015-08-31  7:47         ` Wanpeng Li
2015-09-01 21:45 ` David Matlack
2015-09-01 22:30   ` Wanpeng Li
2015-09-01 22:34     ` David Matlack
2015-09-01 22:58       ` Wanpeng Li
2015-09-01 23:24         ` David Matlack
2015-09-02  0:29           ` Wanpeng Li
2015-09-02  1:49             ` David Matlack
2015-09-02  6:01               ` Wanpeng Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BLU437-SMTP37F331E727F970F8BE6182806F0@phx.gbl \
    --to=wanpeng.li@hotmail.com \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®