summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sysctl.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-04-04 11:13:56 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-04-04 11:13:56 +0000
commit750668c1f913b914d8a963efd94b868662f69102 (patch)
treeaff1e2fa8b787001204f7d8b2d864e543d267ba4 /sys/kern/kern_sysctl.c
parent034c18b1fa0532c3bfd9a8f4af7d6e7ba3512536 (diff)
sysctl kern.pool_debug=0 will disable POOL_DEBUG on the fly (still defaults
to on, if POOL_DEBUG is compiled in, so that boot-time pool corruption can be found. When the sysctl is turned off, performance is almost as as good as compiling with POOL_DEBUG compiled out. Not all pool page headers can be purged of the magic checks. performance tests by henning ok ariane kettenis mikeb
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r--sys/kern/kern_sysctl.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index a2536b7a297..2ac85792d08 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.199 2011/04/02 16:47:17 beck Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.200 2011/04/04 11:13:55 deraadt Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -270,6 +270,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
extern int cryptodevallowsoft;
#endif
extern int maxlocksperuid;
+ extern int pool_debug;
/* all sysctl names at this level are terminal except a ton of them */
if (namelen != 1) {
@@ -591,6 +592,15 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return sysctl_rdstruct(oldp, oldlenp, newp, &dev, sizeof(dev));
case KERN_NETLIVELOCKS:
return (sysctl_rdint(oldp, oldlenp, newp, mcllivelocks));
+ case KERN_POOL_DEBUG: {
+ int old_pool_debug = pool_debug;
+
+ error = sysctl_int(oldp, oldlenp, newp, newlen,
+ &pool_debug);
+ if (error == 0 && pool_debug != old_pool_debug)
+ pool_reclaim_all();
+ return (error);
+ }
default:
return (EOPNOTSUPP);
}