From: Juergen Gross Subject: Re: spinlock requests (was RE: [Patch] don't spin with irq disabled) Date: Tue, 31 Mar 2009 15:40:20 +0200 Message-ID: <49D21D44.6070600@fujitsu-siemens.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Magenheimer Cc: xen-devel@lists.xensource.com, Keir Fraser List-Id: xen-devel@lists.xenproject.org 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. Juergen >> -----Original Message----- >> From: Juergen Gross [mailto:juergen.gross@fujitsu-siemens.com] >> Sent: Monday, March 30, 2009 12:12 AM >> To: Dan Magenheimer >> Cc: Keir Fraser; Jan Beulich; xen-devel@lists.xensource.com >> Subject: Re: spinlock requests (was RE: [Xen-devel] [Patch] don't spin >> with irq disabled) >> >> if you are planning to use rw_locks you should be aware that >> the current >> implementation in Xen is sub-optimal on systems with high >> processor counts. >> Read locks always succeed when other readers are already >> holding the lock, >> even if a writer is waiting for the lock. If there are many >> potential readers >> they might (in theory) lock out a writer for rather long times. >> A better solution would be to stop further readers to acquire >> the lock if a >> writer is waiting for it. -- Juergen Gross Principal Developer IP SW OS6 Telephone: +49 (0) 89 636 47950 Fujitsu Siemens Computers e-mail: juergen.gross@fujitsu-siemens.com Otto-Hahn-Ring 6 Internet: www.fujitsu-siemens.com D-81739 Muenchen Company details: www.fujitsu-siemens.com/imprint.html