From owner-freebsd-arch@FreeBSD.ORG Mon Jun 2 17:35:38 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38A5B106567A for ; Mon, 2 Jun 2008 17:35:38 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 374CD8FC17 for ; Mon, 2 Jun 2008 17:35:38 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 13C821A4D81; Mon, 2 Jun 2008 10:19:46 -0700 (PDT) Date: Mon, 2 Jun 2008 10:19:46 -0700 From: Alfred Perlstein To: Daniel Eischen Message-ID: <20080602171946.GJ48790@elvis.mu.org> References: <483EE7D5.5050408@elischer.org> <20080601215759.GN64397@hoeg.nl> <4843808A.2060501@elischer.org> <48439D06.6020408@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: Ed Schouten , Julian Elischer , arch@freebsd.org Subject: Re: all mutexes -> read-write locks? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jun 2008 17:35:38 -0000 * Daniel Eischen [080602 10:14] wrote: > On Mon, 2 Jun 2008, Julian Elischer wrote: > > > >how does that help making more things use read locking? > > It doesn't, it shows one reason why mutexes can be different > than read/write locks. > > I don't see how most low-level leaf drivers can make use of > read/write locks. All they want to do is prevent simultaneous > access to a device and setup I/O operations. > > By keeping the mutex and rwlock APIs separate regardless of > their implementation, you allow the code to specify what kind > of locking it wants. If you convert all mutexes to rwlocks > you lose this information and it makes it harder to go back > again. On the other hand, if you s/mtx_foo/rw_foo/, you still > have to analyze the code to tell whether or not you can > truly turn them into simultaneous read locks. So what is > the harm in analyzing the code first, and then converting > it to rwlocks IFF it can make use of it? I agree with Daniel here. I also think the following points are relevant: 1) we don't need to rototil the code to s/mtx/rw/ right now. 2) rw locks may not be as effecient as mtx later on and there's no point in doing it right now. -- - Alfred Perlstein