From: George Dunlap <George.Dunlap@eu.citrix.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
"Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>,
Keir Fraser <keir.fraser@eu.citrix.com>
Subject: Re: Linux spin lock enhancement on xen
Date: Tue, 24 Aug 2010 17:11:32 +0100 [thread overview]
Message-ID: <AANLkTimQ9qiFNN6qUutGGL8EO3TF6=X9LNQHG4LuPCQC@mail.gmail.com> (raw)
In-Reply-To: <4C73E4850200007800011E31@vpn.id2.novell.com>
On Tue, Aug 24, 2010 at 2:25 PM, Jan Beulich <JBeulich@novell.com> wrote:
> No, I understood it that way. What I was referring to is (as an
> example) the case where two vCPU-s on the sam pCPU's run queue
> both yield: They will each move after the other in the run queue in
> close succession, but neither will really make progress, and neither
> will really increase the likelihood of the respective lock holder to
> get a chance to run.
Ah, I see. In order for this to be a waste, it needs to be the case that:
* Two vcpus from different domains grab a spinlock and are then preempted
* Two vcpus from different domains then fail to grab the spinlock
* The two vcpus holding the locks are kept from getting cpu by
{another vcpu, other vcpus} which uses a long time-slice
* The two waiting for the lock share a cpu with each other and no one else
Of course in this situation, it would be nice if Xen could migrate one
of the other vcpus to the cpu of the two yielding vcpus. That
shouldn't be too hard to implement, at least to see if it has a
measurable impact on aggregate throughput.
> Immediately, or after a few (hundred) spin cycles?
It depends on the implementation. The Citrix guest tools do binary
patching of spinlock routines for w2k3 and XP; I believe they spin for
1000 cycles or so. The viridian enlightenments I believe would yield
immediately. I think the pause instruction causes a yield immediately
as well.
Yielding immediately when the host is not overloaded is actually
probably not optimal: if the vcpu holding the lock is currently
running, it's likely that by the time the vcpu makes it to the
scheduler, the lock it's waiting for has already been released.
(Which is part of the reason it's a spinlock and not a semaphore.)
> And so I do with this. Apart from suspecting fairness issues with
> your yield_to proposal (as I wrote), my point just is - we won't
> know if a "complicated" solution outperforms a "simple" one if we
> don't try it.
Are you volunteering? :-)
-George
next prev parent reply other threads:[~2010-08-24 16:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-17 1:33 Linux spin lock enhancement on xen Mukesh Rathor
2010-08-17 7:33 ` Keir Fraser
2010-08-17 7:53 ` Jan Beulich
2010-08-18 1:58 ` Mukesh Rathor
2010-08-17 14:34 ` Ky Srinivasan
2010-08-18 1:58 ` Mukesh Rathor
2010-08-17 17:43 ` Jeremy Fitzhardinge
2010-08-18 1:58 ` Mukesh Rathor
2010-08-18 16:37 ` Jeremy Fitzhardinge
2010-08-18 17:09 ` Keir Fraser
2010-08-19 2:52 ` Mukesh Rathor
2010-08-24 8:08 ` George Dunlap
2010-08-24 8:20 ` Keir Fraser
2010-08-24 8:43 ` George Dunlap
2010-08-24 8:48 ` Jan Beulich
2010-08-24 9:09 ` George Dunlap
2010-08-24 13:25 ` Jan Beulich
2010-08-24 16:11 ` George Dunlap [this message]
2010-08-26 14:08 ` Tim Deegan
2010-08-25 1:03 ` Dong, Eddie
2010-08-26 2:13 ` Mukesh Rathor
2010-08-19 2:52 ` Mukesh Rathor
2010-08-23 21:33 ` Jeremy Fitzhardinge
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='AANLkTimQ9qiFNN6qUutGGL8EO3TF6=X9LNQHG4LuPCQC@mail.gmail.com' \
--to=george.dunlap@eu.citrix.com \
--cc=JBeulich@novell.com \
--cc=Xen-devel@lists.xensource.com \
--cc=jeremy@goop.org \
--cc=keir.fraser@eu.citrix.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;
as well as URLs for NNTP newsgroup(s).