Date: Wed, 28 Aug 2002 12:31:48 -0700 From: Mike Makonnen <makonnen@pacbell.net> To: smp@FreeBSD.ORG Subject: Locking questions Message-ID: <20020828123148.7717f871.makonnen@pacbell.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020828123148.7717f871.makonnen>