From owner-p4-projects@FreeBSD.ORG Fri Aug 11 11:42:53 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AAF5E16A4FC; Fri, 11 Aug 2006 11:42:53 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8318B16A4F1; Fri, 11 Aug 2006 11:42:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id BE99943D6A; Fri, 11 Aug 2006 11:42:51 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id C6B8A46D15; Fri, 11 Aug 2006 07:42:50 -0400 (EDT) Date: Fri, 11 Aug 2006 12:42:50 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Roman Divacky In-Reply-To: <200608111110.k7BBAxIO059339@repoman.freebsd.org> Message-ID: <20060811124027.K45647@fledge.watson.org> References: <200608111110.k7BBAxIO059339@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Perforce Change Reviews Subject: Re: PERFORCE change 103633 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2006 11:42:54 -0000 On Fri, 11 Aug 2006, Roman Divacky wrote: > http://perforce.freebsd.org/chv.cgi?CH=103633 > > Change 103633 by rdivacky@rdivacky_witten on 2006/08/11 11:10:09 > > Giantify futex code - this is necessary because the futex code is expected to be atomic. > I need to assure the atomicity. I am using Giant because its sleepable mutex. I hope > someone will point me to some other better solution. Giant is not "sleepable" in the same sense that sx locks, lockmgr locks, etc, are. Normally "sleepable" means that the lock can be held across a sleep of potentially unbounded length, such as msleep(), tsleep(), cv_wait(), etc. Giant is automatically dropped by the kernel on sleep, and re-acquired one wakeup. This means that Giant does not provide mutual exclusion across a sleep -- if this is a property you are relying on, then Giant is not what you want. If you most sleep while holding a lock, I would recommend an sx lock. However, a preferred solution is not to sleep holding a lock. Robert N M Watson Computer Laboratory University of Cambridge