From owner-freebsd-arch@FreeBSD.ORG Wed Oct 13 21:17:22 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A2CF316A4CE; Wed, 13 Oct 2004 21:17:22 +0000 (GMT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0864C43D39; Wed, 13 Oct 2004 21:17:22 +0000 (GMT) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.1/8.13.1) with ESMTP id i9DLHEKS076320; Wed, 13 Oct 2004 14:17:18 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <200410132117.i9DLHEKS076320@gw.catspoiler.org> Date: Wed, 13 Oct 2004 14:17:14 -0700 (PDT) From: Don Lewis To: ssouhlal@FreeBSD.org In-Reply-To: <1C45EA64-1D5B-11D9-A525-000A95C4D7BC@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: freebsd-arch@FreeBSD.org Subject: Re: [RFC] sysctl locking X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2004 21:17:22 -0000 On 13 Oct, Suleiman Souhlal wrote: > Hi, > > On Oct 11, 2004, at 3:30 PM, Don Lewis wrote: >> There seems to be a lot of locking/unlocking overhead in the oid lookup >> and oid tree manipulation code. Doing the traversals at each level of >> the tree without holding a lock for the entire time makes me nervous, >> though I can't point to any specific problem. It might be better to >> just hold a single lock across then entire lookup, insertion, or >> deletion operation. > > Thanks for your reply! I think you are right. It would also make the > locking much simpler. However, there is the problem that sysctl > handlers can sleep, so we shouldn't be holding a mutex when calling > them.. Unlock the mutex after doing the lookup and getting ownership of the oid, and before calling the handler.