From: Rik van Riel <riel@redhat.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Avi Kiviti <avi@redhat.com>,
Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Mike Galbraith <efault@gmx.de>,
Chris Wright <chrisw@sous-sol.org>,
ttracy@redhat.com, dshaks@redhat.com
Subject: [RFC -v5 PATCH 0/4] directed yield for Pause Loop Exiting
Date: Fri, 14 Jan 2011 03:02:09 -0500 [thread overview]
Message-ID: <20110114030209.53765a0a@annuminas.surriel.com> (raw)
When running SMP virtual machines, it is possible for one VCPU to be
spinning on a spinlock, while the VCPU that holds the spinlock is not
currently running, because the host scheduler preempted it to run
something else.
Both Intel and AMD CPUs have a feature that detects when a virtual
CPU is spinning on a lock and will trap to the host.
The current KVM code sleeps for a bit whenever that happens, which
results in eg. a 64 VCPU Windows guest taking forever and a bit to
boot up. This is because the VCPU holding the lock is actually
running and not sleeping, so the pause is counter-productive.
In other workloads a pause can also be counter-productive, with
spinlock detection resulting in one guest giving up its CPU time
to the others. Instead of spinning, it ends up simply not running
much at all.
This patch series aims to fix that, by having a VCPU that spins
give the remainder of its timeslice to another VCPU in the same
guest before yielding the CPU - one that is runnable but got
preempted, hopefully the lock holder.
v5:
- fix the race condition Avi pointed out, by tracking vcpu->pid
- also allows us to yield to vcpu tasks that got preempted while in qemu
userspace
v4:
- change to newer version of Mike Galbraith's yield_to implementation
- chainsaw out some code from Mike that looked like a great idea, but
turned out to give weird interactions in practice
v3:
- more cleanups
- change to Mike Galbraith's yield_to implementation
- yield to spinning VCPUs, this seems to work better in some
situations and has little downside potential
v2:
- make lots of cleanups and improvements suggested
- do not implement timeslice scheduling or fairness stuff
yet, since it is not entirely clear how to do that right
(suggestions welcome)
Benchmark "results":
Two 4-CPU KVM guests are pinned to the same 4 physical CPUs.
One guest runs the AMQP performance test, the other guest runs
0, 2 or 4 infinite loops, for CPU overcommit factors of 0, 1.5
and 4.
The AMQP perftest is run 30 times, with 8 and 16 threads.
8thr no overcommit 1.5x overcommit 2x overcommit
no PLE 198918 132625 90523.5
PLE 213904 127507 95098.5
16thr no overcommit 1.5x overcommit 2x overcommit
no PLE 197526 127941 87187.8
PLE 210696 136874 87005.9
Note: there seems to be something wrong with CPU balancing,
possibly related to cgroups. The AMQP guest only got about
80% CPU time (of 400% total) when running with 2x overcommit,
as opposed to the expected 200%. Without PLE, the guest
seems to get closer to 100% CPU time, which is still far
below the expected.
Without overcommit, the AMQP guest gets about 340-350%
CPU time without the PLE code, and around 380% CPU time
with the PLE code kicking the scheduler around.
Unfortunately, it looks like this test ended up more as a
demonstration of other scheduler issues, than as a performance
test of the PLE code.
--
All rights reversed.
next reply other threads:[~2011-01-14 8:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-14 8:02 Rik van Riel [this message]
2011-01-14 8:03 ` [RFC -v5 PATCH 1/4] kvm: keep track of which task is running a KVM vcpu Rik van Riel
2011-01-16 15:17 ` Avi Kivity
2011-01-14 8:03 ` [RFC -v5 PATCH 2/4] sched: Add yield_to(task, preempt) functionality Rik van Riel
2011-01-14 17:15 ` Peter Zijlstra
2011-01-14 17:47 ` Srivatsa Vaddagiri
2011-01-14 18:29 ` Rik van Riel
2011-01-17 15:53 ` Srivatsa Vaddagiri
2011-01-14 8:04 ` [RFC -v5 PATCH 3/4] export pid symbols needed for kvm_vcpu_on_spin Rik van Riel
2011-01-16 15:18 ` Avi Kivity
2011-01-14 8:05 ` [RFC -v5 PATCH 4/4] kvm: use yield_to instead of sleep in kvm_vcpu_on_spin Rik van Riel
2011-01-14 17:34 ` [RFC -v5 PATCH 0/4] directed yield for Pause Loop Exiting Rik van Riel
2011-01-14 21:29 ` Rik van Riel
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=20110114030209.53765a0a@annuminas.surriel.com \
--to=riel@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=avi@redhat.com \
--cc=chrisw@sous-sol.org \
--cc=dshaks@redhat.com \
--cc=efault@gmx.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ttracy@redhat.com \
--cc=vatsa@linux.vnet.ibm.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®