From owner-freebsd-smp Wed Aug 28 12:18:41 2002 Delivered-To: freebsd-smp@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8C93937B401 for ; Wed, 28 Aug 2002 12:18:34 -0700 (PDT) Received: from mta5.snfc21.pbi.net (mta5.snfc21.pbi.net [206.13.28.241]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8E36543E6E for ; Wed, 28 Aug 2002 12:18:33 -0700 (PDT) (envelope-from makonnen@pacbell.net) Received: from kokeb.ambesa.net ([64.166.85.234]) by mta5.snfc21.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0H1K00LSCIYTZM@mta5.snfc21.pbi.net> for smp@FreeBSD.ORG; Wed, 28 Aug 2002 12:18:30 -0700 (PDT) Received: from kokeb.ambesa.net (tanstaafl@localhost [IPv6:::1]) by kokeb.ambesa.net (8.12.5/8.12.5) with ESMTP id g7SJVmlH001379 for ; Wed, 28 Aug 2002 12:31:48 -0700 (PDT envelope-from mtm@kokeb.ambesa.net) Received: (from mtm@localhost) by kokeb.ambesa.net (8.12.5/8.12.5/Submit) id g7SJVm8W001378; Wed, 28 Aug 2002 12:31:48 -0700 (PDT) Date: Wed, 28 Aug 2002 12:31:48 -0700 From: Mike Makonnen Subject: Locking questions To: smp@FreeBSD.ORG Message-id: <20020828123148.7717f871.makonnen@pacbell.net> MIME-version: 1.0 X-Mailer: Sylpheed version 0.7.8 (GTK+ 1.2.10; i386-portbld-freebsd5.0) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi folks, I resumed working on my resource limit lock patch, and I have a couple of questions. 1. I get "duplicate lock of same type" witness warnings because of this: limhold(plimit) { lock(plimit), bump refcount, unlock(plimit) } newlim = limget(); PROC_LOCK(p2); PROC_LOCK(p1); LIM_LOCK(p1->p_limit); if (p1->p_limit->p_lflags & PL_SHAREMOD) { limcopy(newlim, p1->p_limit); p2->p_limit = limhold(newlim); } else { p2->p_limit = limhold(p1->p_limit); } LIM_UNLOCK(p1->p_limit); PROC_UNLOCK(p1); PROC_UNLOCK(p2); limfree(newlim); newlim = NULL; I get this message in limhold() because of: p2->p_limit = limhold(p1->p_limit); Why is this bad? Is it safe to drop the p1->p_plimit lock right before I do the hold? It should be because you need both a PROC_LOCK and a LIM_LOCK to modify the plimit. 2. Should I add the plimit lock to static struct witness_order_list_entry order_lists[] ? What is the rationale behind the ordering of the list? Cheers, Mike Makonnen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message