From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH] switch rangeset's lock to rwlock Date: Mon, 28 Mar 2011 09:23:02 +0100 Message-ID: <4D90618602000078000389AE@vpn.id2.novell.com> References: <4D8CD5BB02000078000386C1@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org >>> On 25.03.11 at 18:08, Keir Fraser wrote: > I'd rather get rid of rwlocks altogether and use RCU in any cases where = we > really have contention. Rwlocks don't help unless the read-side critical > sections are large enough to amortise the cache ping-pong cost of the > locking/unlocking operations. And in Xen we have very few if any > significantly sized critical sections. As I said in the description, the rangeset code is of general library kind, and hence shouldn't make assumptions on the sort of data stored in rangesets. While I agree that in many cases the read side critical section would be small, there can be exceptions. Using RCU in this kind of a leaf, independent of almost anything else library routine would seem odd. The only reason to stay with spinlocks was imo if you indeed wanted to knock off rwlocks altogether, which would new seem contrary to your c/s 23099:612171ff82ea. > I need to double check, but I believe we have only a couple of rwlock = users > now, and none of the read-side critical sections are large, so in that = case > I suggest we switch them to use spinlocks and kill our rwlock > implementation. Indeed, there's only tmem without the two patches I had sent. One of the reasons for putting them together was to actually have some *active* users of rwlocks again, so the code wouldn't have too good chances to bit-rot. Further, I've taken note of a few other locks that may be candidates for conversion to rwlocks (pcidevs_lock being the most prominent example), requiring closer inspection and possibly code adjustments other than the mere lock kind conversion. Jan