From owner-freebsd-arch@FreeBSD.ORG Sun Jan 25 04:25:41 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 F117F106566C for ; Sun, 25 Jan 2009 04:25:41 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.225]) by mx1.freebsd.org (Postfix) with ESMTP id C4A5D8FC12 for ; Sun, 25 Jan 2009 04:25:41 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so5480360rvf.43 for ; Sat, 24 Jan 2009 20:25:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=cnt7hmpcu039z+pH2Z1IcrJLBPTkhIyF/iLiudJ1pxE=; b=Jmb6NhLc4RvntpCrjTgcXsG61X9tG2yDyHbneXatRCiJ1d/YCfJ507QmorLHwaF6WV mO0W+lBVgGMEuLaQJfUo5jfMO3IvHK3I0p/PGu4A1Oeqa9GRt4OTgKpQ/CgOgTg8TuNB W6NdXNQ+tSMxiridNSzLX/b6I0ajNoED1CI1o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=s/xbz3sUnZ94pYlvCSJGAOpTHX2KTCw7DMByvY44WukwyDGi/PCXKcSi231wFlbuNY W6f5B2DSSem7d2I8NPZimS4FC3jArCQ9jyDtLpjtBvTl+ut0m1XVmDNRQft4OoeY7Oid Qs8W7suQd8YorZCwReixp4lcS5/1ukXisB5XE= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.140.170.21 with SMTP id s21mr1039592rve.205.1232855803849; Sat, 24 Jan 2009 19:56:43 -0800 (PST) In-Reply-To: <497BA91D.805@elischer.org> References: <497BA91D.805@elischer.org> Date: Sat, 24 Jan 2009 19:56:43 -0800 X-Google-Sender-Auth: a6e2a05d4e55e352 Message-ID: <3c1674c90901241956j244ed067p7ff4df5454beba82@mail.gmail.com> From: Kip Macy To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: 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: Sun, 25 Jan 2009 04:25:42 -0000 The adaptive spinning of regular mutexes already satisfies your need for "short" hold. You might wish to add a thread flag used when INVARIANTS is enabled that is set when a leaf mutex is acquired and checked on all mutex acquisitions. -Kip On Sat, Jan 24, 2009 at 3:49 PM, Julian Elischer wrote: > Currently we have: > spin locks.. > you really don't want to hold these for > any time at all, and this is enforced to some extent in the waiter. > > regular mutexes.. > You can hold these for as long as you want but teh shorter > the better and you can't sleep when holding them. The > "shortness" of the time of holding the mutex is not enforced. > > "Sleeps" (including sx-locks and friends) > You may hold these or be descheduled for really long periods of time. > > > Now it occurs to me that there is a subclass of regular mutexes, > usage, which is where you want to use a mutex to guard some small > but critical structure, and that you know that access to that structure will > be quick, and that you can guarantee that you will > not acquire any other locks (which could introduce unknown delay) > while hoding the lock. > > One way of thinking about this is that this lock would always be > a leaf node on the tree of lock orders. > I would like to be able to add a flag to a mutex > that tags it as a 'leaf' mutex. As a result it would be illegal > to take any other mutex while holding a leaf mutex. Somewhat > similar to the way that it is illegal to take aregular > mutex while holding a spin mutex.. > > > In netgraph I have a stipulation that is hard to specify which > is that you MAY take a mutex in a netgraph node if you can guarantee > that the mutex WILL be satisfied very quickly, but it'd > be nice to be able to specify "you may only take 'leaf' mutexes within an > netgraph node". > > > thoughts? (especially from jhb and other locking types). > > > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" >