[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: spinlock requests (was RE: [Xen-devel] [Patch] don't spin with irq disabled)



Keir Fraser wrote:
On 31/03/2009 14:40, "Juergen Gross" <juergen.gross@xxxxxxxxxxxxxxxxxxx>
wrote:

Dan Magenheimer wrote:
Thanks Juergen.  Do you know of any GPLv2 code that implements
this improved rwlock solution?  (I don't think Linux does,
does it?)
Good question.
I just looked into the Linux code and decided not to analyse it. :-)
I have implemented a solution for our BS2000 system on Xen. It is just
a rather simple state machine using the cmpxchg instruction for the
update of the (structured) lock word.
If there is common interest for this solution I could prepare a patch.

If we care that much about fairness we should use ticket- or queue-based
locks. I don't believe any of our locks are contended enough to be a
concern. If they were, that would be a concern in itself.

Writer vs reader fairness in rwlocks is different from normal spinlock fairness. One presumes that you're expecting to get multiple readers if you choose to use a rwlock, but that can end up excluding writers for an unbounded amount of time.

There was a big discussion of this on lkml about 6-9 months ago, because people were seeing writers held off for long periods of time. I think the kernel's rwlock now blocks new readers if a writer if waiting for the lock.

   J

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.