diff options
author | ed <ed@FreeBSD.org> | 2009-01-28 19:58:05 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-01-28 19:58:05 +0000 |
commit | 50efccc9f04a04f03e963eee6a0f24acb1b0cec9 (patch) | |
tree | 1d14b0eff13e12254c67fc494563bb9db0a4586e /sys/fs/devfs/devfs_devs.c | |
parent | 35d15d6dd37a1883bbacef0efed00f7aadee89ec (diff) | |
download | FreeBSD-src-50efccc9f04a04f03e963eee6a0f24acb1b0cec9.zip FreeBSD-src-50efccc9f04a04f03e963eee6a0f24acb1b0cec9.tar.gz |
Mark most often used sysctl's as MPSAFE.
After running a `make buildkernel', I noticed most of the Giant locks in
sysctl are only caused by a very small amount of sysctl's:
- sysctl.name2oid. This one is locked by SYSCTL_LOCK, just like
sysctl.oidfmt.
- kern.ident, kern.osrelease, kern.version, etc. These are just constant
strings.
- kern.arandom, used by the stack protector. It is already protected by
arc4_mtx.
I also saw the following sysctl's show up. Not as often as the ones
above, but still quite often:
- security.jail.jailed. Also mark security.jail.list as MPSAFE. They
don't need locking or already use allprison_lock.
- kern.devname, used by devname(3), ttyname(3), etc.
This seems to reduce Giant locking inside sysctl by ~75% in my primitive
test setup.
Diffstat (limited to 'sys/fs/devfs/devfs_devs.c')
-rw-r--r-- | sys/fs/devfs/devfs_devs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index 028f5c9..4041911 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -103,8 +103,9 @@ sysctl_devname(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_PROC(_kern, OID_AUTO, devname, CTLTYPE_OPAQUE|CTLFLAG_RW|CTLFLAG_ANYBODY, - NULL, 0, sysctl_devname, "", "devname(3) handler"); +SYSCTL_PROC(_kern, OID_AUTO, devname, + CTLTYPE_OPAQUE|CTLFLAG_RW|CTLFLAG_ANYBODY|CTLFLAG_MPSAFE, + NULL, 0, sysctl_devname, "", "devname(3) handler"); SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev, CTLFLAG_RD, 0, sizeof(struct cdev), "sizeof(struct cdev)"); |