From owner-freebsd-threads@FreeBSD.ORG Fri Apr 18 03:49:59 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA85A37B401; Fri, 18 Apr 2003 03:49:59 -0700 (PDT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id DC94343F85; Fri, 18 Apr 2003 03:49:58 -0700 (PDT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.12.9/8.12.9) with SMTP id h3IAoDua039356; Fri, 18 Apr 2003 06:50:14 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Fri, 18 Apr 2003 06:50:12 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Terry Lambert In-Reply-To: <3E9FAE89.4D656F38@mindspring.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-threads@freebsd.org cc: David Xu cc: Daniel Eischen Subject: Re: libpthread patch X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2003 10:50:00 -0000 On Fri, 18 Apr 2003, Terry Lambert wrote: > You are allowed to recurse on a mutex in the kernel, because there's > some depth to code paths that shouldn't be there, but it's easier to > allow recursion than it is to correct the code. By default, mutexes are not permitted to be recursed, and recursing them will cause a panic. Recursion is only permitted if the MTX_RECURSE flag is set at mutex initialization time, which is strongly discouraged. There are several mutex in the kernel where the flag is set, but I hope to see the list remain small (and go down). A quick grep of of kern shows four classes of mutexes with MTX_RECURSE set (one is Giant), and 57 without (approximately). The IP stack locking, on the other hand, has four mutex classes, of which two permit recursion (PCB locks). Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Network Associates Laboratories