From owner-freebsd-arch@FreeBSD.ORG Wed Jan 28 09:00:32 2009 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 888A0106566B; Wed, 28 Jan 2009 09:00:32 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 60E5D8FC12; Wed, 28 Jan 2009 09:00:32 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id C21D646B6C; Wed, 28 Jan 2009 04:00:31 -0500 (EST) Date: Wed, 28 Jan 2009 09:00:31 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Julian Elischer In-Reply-To: <497DFB61.1010602@elischer.org> Message-ID: References: <497BA91D.805@elischer.org> <497D5DF8.8000706@elischer.org> <20090126105140.GL5889@elvis.mu.org> <200901260936.18232.jhb@freebsd.org> <497DFB61.1010602@elischer.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: arch@freebsd.org, Alfred Perlstein , Kip Macy , freebsd-arch@freebsd.org Subject: Re: need for another mutex type/flag? 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: Wed, 28 Jan 2009 09:00:33 -0000 On Mon, 26 Jan 2009, Julian Elischer wrote: > maybe what I want is to be able to label a lock as "fleeting" By which I > mean that the work that would be done while holding this lock would be > fleeting (momentary) in nature. > > An example f a fleeting lock would be something that gains the lock in order > to safely switch two pointers. no malloc is required and nothing is going to > take a long time. > > locks that are NOT momentary include holding the process list lock while > allocating a large buffer (series of them) and dumping the contents of all > processes and things like that. > > one might almost say that a fleeting lock might be gotten while holding > another fleeting lock, but that is pushing it for me.. It was probably clear from my previous e-mail, but just in case it wasn't: we already do this. Mutexes and rwlocks (and rmlocks for that matter) fall into the category you call "fleeting", which are allowed to be held over one another (subject to lock order), but never over "non-fleeting" locks such as sx and lockmgr locks. This is comparable to the upper/lower half kernel concept that existed previously: one is allowed to wait for the other, but not vice versa; we allow ithreads to acquire mutexes and rwlocks, but not sx locks because that might involve waiting for themselves. Robert N M Watson Computer Laboratory University of Cambridge