From owner-cvs-src@FreeBSD.ORG Sun Nov 25 18:05:39 2007 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A059716A469 for ; Sun, 25 Nov 2007 18:05:39 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outH.internet-mail-service.net (outH.internet-mail-service.net [216.240.47.231]) by mx1.freebsd.org (Postfix) with ESMTP id 7177913C46B for ; Sun, 25 Nov 2007 18:05:39 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Sun, 25 Nov 2007 10:05:38 -0800 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 266D2126AD2; Sun, 25 Nov 2007 10:05:38 -0800 (PST) Message-ID: <4749B971.3000703@elischer.org> Date: Sun, 25 Nov 2007 10:05:37 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Daniel Eischen References: <200711081447.lA8EltXO052057@repoman.freebsd.org> <47492064.7080108@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Stephan Uphoff , cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/share/man/man9 locking.9 rmlock.9 src/sys/conf files src/sys/kern kern_rmlock.c subr_lock.c subr_pcpu.c subr_smp.c src/sys/sys _rmlock.h lock.h pcpu.h rmlock.h smp.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2007 18:05:39 -0000 Daniel Eischen wrote: > On Sat, 24 Nov 2007, Darren Reed wrote: > >> Stephan Uphoff wrote: >>> ups 2007-11-08 14:47:55 UTC >>> >>> FreeBSD src repository >>> >>> Modified files: >>> share/man/man9 locking.9 sys/conf files >>> sys/kern subr_lock.c subr_pcpu.c subr_smp.c sys/sys >>> lock.h pcpu.h smp.h Added files: >>> share/man/man9 rmlock.9 sys/kern >>> kern_rmlock.c sys/sys _rmlock.h rmlock.h Log: >>> Initial checkin for rmlock (read mostly lock) a multi reader single >>> writer >>> lock optimized for almost exclusive reader access. (see also rmlock.9) >>> >> >> Is there a white paper or other documentation around somewhere that >> discusses the benefits/tradeoffs with using rmlock vs rwlock? > > Why aren't we using the rwlock interfaces, but just allowing a different > behavior when the lock is created (rwlock_init2() or something)? It > would seem simpler to keep the same interface and allow easy toggling > between rwlocks and rmlocks. The same way we can initialize kernel > mutexes differently (MTX_DEF, MTX_SPIN) could be applied here. > I think that If anything, we should be going in the other direction.. firstly, mutexes are just rw_locks with no readers. So we might as well make them the same thing.. Spin and blocking mutexes should in my opinion be defined as different structures, at least in name so that the compiler hits you with a clue-bat when you try use a spin-lock with non-spinlock ops etc. not sure why sx-locks exist at all, as they seem to be a variant of sleep. I think it's just a convenience function set to allow one to implement a sleep-derived synchronisation.