[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC] sysctl locking
- Subject: [RFC] sysctl locking
- From: ssouhlal at FreeBSD.org (Suleiman Souhlal)
- Date: Wed Oct 13 14:02:03 2004
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_(_at_)_vt_(_dot_)_edu
The FreeBSD Project | ssouhlal_(_at_)_FreeBSD_(_dot_)_org
Visit your host, monkey.org