Date: Wed, 13 Oct 2004 17:01:53 -0400 From: Suleiman Souhlal <ssouhlal@FreeBSD.org> To: Don Lewis <truckman@FreeBSD.org> Cc: freebsd-arch@FreeBSD.org Subject: Re: [RFC] sysctl locking Message-ID: <1C45EA64-1D5B-11D9-A525-000A95C4D7BC@FreeBSD.org> In-Reply-To: <200410111930.i9BJUODI068849@gw.catspoiler.org> References: <200410111930.i9BJUODI068849@gw.catspoiler.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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.. > What happens if: > thread A owns an oid > > thread B, which wants to delete the oid, goes to sleep to wait > for the oid > > thread C wants the oid and goes to sleep > > thread A releases the oid and wakes up thread B > > thread B deletes the oid > > thread C does ??? I didn't think of this possibility. I guess I'll have to rethink the whole thing, whenever I find some time. -- Suleiman Souhlal | ssouhlal@vt.edu The FreeBSD Project | ssouhlal@FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1C45EA64-1D5B-11D9-A525-000A95C4D7BC>