[RFC] sysctl locking

Don Lewis truckman at FreeBSD.org
Wed Oct 13 14:17:22 PDT 2004


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.



More information about the freebsd-arch mailing list