From owner-cvs-all Wed Dec 13 11:10:16 2000 From owner-cvs-all@FreeBSD.ORG Wed Dec 13 11:10:10 2000 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 414C037B404; Wed, 13 Dec 2000 11:10:10 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id eBDJA9r28452; Wed, 13 Dec 2000 11:10:09 -0800 (PST) Date: Wed, 13 Dec 2000 11:10:09 -0800 From: Alfred Perlstein To: Matt Dillon Cc: tanimura@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, jhb@FreeBSD.ORG, cp@FreeBSD.ORG Subject: Re: cvs commit: src/sys/ufs/ffs ffs_vfsops.c Message-ID: <20001213111008.H16205@fw.wintelcom.net> References: <200012131003.eBDA3rh34394@freefall.freebsd.org> <20001213024954.B16205@fw.wintelcom.net> <200012131852.eBDIqm584821@earth.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200012131852.eBDIqm584821@earth.backplane.com>; from dillon@earth.backplane.com on Wed, Dec 13, 2000 at 10:52:48AM -0800 Sender: bright@fw.wintelcom.net Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Matt Dillon [001213 10:53] wrote: > :Thus it should be even better to enter to and exit from the ufs hash > :mutex in the functions shown above. > : > :Alfred> That maybe the code should be using wakeup_one() as well? I'm > :Alfred> not sure how wakeup_one works with respect to FIFO or LIFO, > :Alfred> if it's LIFO then this can cause problems because of lots of > :Alfred> processes wedged on this getting stuck behind the newcomers. > :Alfred> If it's FIFO we should be fine. > : > :A sleep queue is a TAILQ, which is FIFO. So wakeup_one() should work. > : > :-- > :Seigo Tanimura > > I have one request here. In order for wakeup_one() to work, any > waiting tasks *must* attempt to obtain the lock when they are woken up > rather then (potentially) abort and do something else, or no other > task will be woken up. > > I would like all instances where tasks wait here, or in the single > instance if we are talking about a centralized locking routine, to > document this requirement in a comment. > > We do not want to run up against the situation where some future > programmer believes he can wait for a lock and then abort when he > is woken up (e.g. if getting a signal) rather then actually obtain > the lock. This would not even be a problem if we just used a mutex instead of a mutex over a mutual exclusion lock. The mutex code should properly do a wakeup_one() internally. BSD/os is our reference implementation, but that doesn't mean they are correct 100% of the time. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message