Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jan 2009 17:41:24 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        freebsd-current@freebsd.org, scottl@freebsd.org
Subject:   Re: sysctl question
Message-ID:  <200901281741.25021.jhb@freebsd.org>
In-Reply-To: <20090128220454.GA66961@freebsd.org>
References:  <20090128193318.GA42071@freebsd.org> <200901281521.17674.jhb@freebsd.org> <20090128220454.GA66961@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 28 January 2009 5:04:54 pm Roman Divacky wrote:
> On Wed, Jan 28, 2009 at 03:21:17PM -0500, John Baldwin wrote:
> > On Wednesday 28 January 2009 2:33:18 pm Roman Divacky wrote:
> > > hi
> > > 
> > > we dont need Giant to be held for sysctl_ctx_init/SYSCTL_ADD_*, right?
> > 
> > Ugh, it looks like the sysctl tree locking is woefully inadequate, so we 
> > aren't quite ready for this yet.
> 
> what do you mean? should all sysctl_ctx_init/SYSCTL_ADD_* consumers lock
> Giant? I didnt not find a single one (except the scsi stuff) that locks
> it...
> 
> can you explain? thnx

The supposed sysctl lock in kern_sysctl.c is actually worthless.  None of the 
routines that actually manipulate the sysctl tree to add and remove nodes use 
it.  Only sysctl itself uses it.  It replaces an old 'memlock' hand-rolled 
lock from 4.xBSD (in 1.1 of kern_sysctl.c) that I think has to do with 
limiting the amount of wired memory, as it looks like sysctl used to always 
wire the userland buffers.  I've just submitted some changes to p4 to make 
the sysctl lock actually protect the sysctl tree that I will test soon.  Once 
that stuff is done then Giant can be removed here and other places.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901281741.25021.jhb>