Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Apr 2001 11:45:07 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Barney Wolff <barney@databus.com>
Cc:        smp@FreeBSD.org, Robert Watson <rwatson@FreeBSD.org>, "Andrew R. Reiter" <arr@watson.org>
Subject:   Re: sysctl's and mutexes
Message-ID:  <XFMail.010424114507.jhb@FreeBSD.org>
In-Reply-To: <20010424135845.A10320@mx.databus.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 24-Apr-01 Barney Wolff wrote:
> Pardon an outsider's question, but what exactly are these mutex's
> supposed to protect?  Would a reader of a sysctl value have to
> acquire a read lock in order to read a non-atomic value?
> 
> Is the rate at which these values are set and/or read so high
> as to justify more than a single mutex for the lot?  Are there
> any operations that take long enough that anything other than
> a spinlock is justified?
> 
> Sorry if these are dumb questions - I'm just a KISS sort of guy.

If a user is using a sysctl to read/write a variable that we protect with a
given lock inside the kernel, we need to use that same lock to protect the data
in the sysctl handler.  Granted, for some read-only sysctl's, it could be
perfectly fine to not grab a lock while performing the sysctl.  The trick
though is that you always need to use the same locks to protect a given piece
of data.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

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?XFMail.010424114507.jhb>