svn commit: r236380 - head/sys/vm

mdf at FreeBSD.org mdf at FreeBSD.org
Fri Jun 1 16:03:38 UTC 2012


On Fri, Jun 1, 2012 at 2:14 AM, Bruce Evans <brde at optusnet.com.au> wrote:
>>> +SYSCTL_OID(_vm, OID_AUTO, swap_free,
>>> CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_MPSAFE,
>>> +               NULL, 0, sysctl_vm_swap_free, "Q",
>>> +               "Blocks of free swap storage.");
>
>
> Bug 9 is a style bug.  I didn't even know that the raw SYSCTL_OID() could
> be misused like this.  The normal SYSCTL_PROC() is identical with
> SYSCTL_OID() except it checks that the access flags are not 0.  Few or no
> SYSCTL_FOO()s have no access flags, and this is not one.  It has rather
> excessive access flags (I think CTLFLAG_MPSAFE is unnecessary.

I wanted to correct this one point.  CTLFLAG_MPSAFE is helpful,
because its use prevents kern_sysctl from taking Giant before calling
the sysctl handler.  It's probably nearing the case, now, that any
sysctl *without* CTLFLAG_MPSAFE is incorrect, except perhaps for a few
that set/get text strings that don't want to roll their own
serialization.

Cheers,
matthew


More information about the svn-src-head mailing list