From owner-cvs-all@FreeBSD.ORG Thu Sep 15 21:30:06 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EF4D116A41F; Thu, 15 Sep 2005 21:30:06 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6FDE143D45; Thu, 15 Sep 2005 21:30:06 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with ESMTP id 01AA246B38; Thu, 15 Sep 2005 17:30:06 -0400 (EDT) Date: Thu, 15 Sep 2005 22:30:05 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Scott Long In-Reply-To: <4329E739.4070707@samsco.org> Message-ID: <20050915222821.W75005@fledge.watson.org> References: <200509151905.j8FJ5beJ008055@repoman.freebsd.org> <20050915205233.GA23141@garage.freebsd.pl> <4329E739.4070707@samsco.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek , cvs-all@FreeBSD.org, John Baldwin Subject: Re: cvs commit: src/sys/kern kern_intr.c subr_sleepqueue.c src/sys/geom geom_io.c src/sys/sys proc.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2005 21:30:07 -0000 On Thu, 15 Sep 2005, Scott Long wrote: >> So is this still possible to use mutexes in I/O paths (g_up/g_down >> threads) or it will panic immediatelly? >> >> The policy for now was: using mutexes in a sane way is possible. The >> question is: did we went from a warning when WITNESS is enabled to a >> panic with INVARIANTS only? > > Well, there is a subtle distinction here that isn't well understood. > Sleep mutexes "block", they don't "sleep". "Sleeping" implies that > scheduling is lost for the thread for an unbounded period of time. > "Blocking" implies that scheduling is lost for a relatively short and > bounded period of time. So yes, sleep mutexes are still allowed. Unless of course you're talking about blocking as in I/O, in which case blocking refers to unbounded sleeping associated with waiting on I/O events, hence non-blocking I/O. However, even if you set a file descriptor to non-blocking, your thread may still sleep waiting on a mutex (bounded sleeps) or on kernel memory (unbounded sleeps). I try to avoid using the term blocking except when talking about file descriptors, and then just confuse people by using sleep to mean both "what a mutex can do" and "what tsleep does". The useful distinction basically being a convention on the degree to which things are bounded... Robert N M Watson