svn commit: r187656 - in head/sys: kern sys
John Baldwin
jhb at FreeBSD.org
Fri Jan 23 14:40:35 PST 2009
Author: jhb
Date: Fri Jan 23 22:40:35 2009
New Revision: 187656
URL: http://svn.freebsd.org/changeset/base/187656
Log:
Add a flag to tag individual sysctl leaf nodes as MPSAFE and thus not
needing Giant.
Submitted by: csjp (an older version)
Modified:
head/sys/kern/kern_sysctl.c
head/sys/sys/sysctl.h
Modified: head/sys/kern/kern_sysctl.c
==============================================================================
--- head/sys/kern/kern_sysctl.c Fri Jan 23 22:13:30 2009 (r187655)
+++ head/sys/kern/kern_sysctl.c Fri Jan 23 22:40:35 2009 (r187656)
@@ -1334,11 +1334,11 @@ sysctl_root(SYSCTL_HANDLER_ARGS)
if (error != 0)
return (error);
#endif
-
- /* XXX: Handlers are not guaranteed to be Giant safe! */
- mtx_lock(&Giant);
+ if (!(oid->oid_kind & CTLFLAG_MPSAFE))
+ mtx_lock(&Giant);
error = oid->oid_handler(oid, arg1, arg2, req);
- mtx_unlock(&Giant);
+ if (!(oid->oid_kind & CTLFLAG_MPSAFE))
+ mtx_unlock(&Giant);
return (error);
}
Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h Fri Jan 23 22:13:30 2009 (r187655)
+++ head/sys/sys/sysctl.h Fri Jan 23 22:40:35 2009 (r187656)
@@ -84,6 +84,7 @@ struct ctlname {
#define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */
#define CTLMASK_SECURE 0x00F00000 /* Secure level */
#define CTLFLAG_TUN 0x00080000 /* Tunable variable */
+#define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */
#define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN)
/*
More information about the svn-src-head
mailing list