summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2009-06-03 21:30:21 +0000
committerBob Beck <beck@cvs.openbsd.org>2009-06-03 21:30:21 +0000
commite4c01a324522cec2879a3f95a917b6434020498a (patch)
treeef6db87f8ac740cc6d4f3d0065d284571f6c9e72 /sys
parentcffdd398610e708a53403eb903038d25b2ce9319 (diff)
add kern.bufcachepercent sysctl to allow adjusting the buffer cache
size on a running system. ok art@, oga@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/machdep.c8
-rw-r--r--sys/arch/aviion/aviion/machdep.c8
-rw-r--r--sys/arch/hp300/hp300/machdep.c8
-rw-r--r--sys/arch/hppa/hppa/machdep.c8
-rw-r--r--sys/arch/hppa64/hppa64/machdep.c8
-rw-r--r--sys/arch/i386/i386/machdep.c7
-rw-r--r--sys/arch/luna88k/luna88k/machdep.c8
-rw-r--r--sys/arch/mac68k/mac68k/machdep.c8
-rw-r--r--sys/arch/macppc/macppc/machdep.c8
-rw-r--r--sys/arch/mvme68k/mvme68k/machdep.c8
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c8
-rw-r--r--sys/arch/mvmeppc/mvmeppc/machdep.c8
-rw-r--r--sys/arch/sgi/sgi/machdep.c8
-rw-r--r--sys/arch/socppc/socppc/machdep.c8
-rw-r--r--sys/arch/solbourne/solbourne/machdep.c8
-rw-r--r--sys/arch/sparc/sparc/machdep.c8
-rw-r--r--sys/arch/vax/vax/machdep.c8
-rw-r--r--sys/kern/kern_sysctl.c19
-rw-r--r--sys/kern/vfs_bio.c29
-rw-r--r--sys/sys/mount.h4
-rw-r--r--sys/sys/sysctl.h6
21 files changed, 70 insertions, 123 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index d8492b681a0..f3f42876d2f 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.92 2009/06/02 03:04:54 jordan Exp $ */
+/* $OpenBSD: machdep.c,v 1.93 2009/06/03 21:30:19 beck Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -399,12 +399,6 @@ setup_buffers()
*/
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
-
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
}
/*
diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c
index f7f5f12df18..3b8237656c5 100644
--- a/sys/arch/aviion/aviion/machdep.c
+++ b/sys/arch/aviion/aviion/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.27 2009/04/19 17:56:12 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.28 2009/06/03 21:30:19 beck Exp $ */
/*
* Copyright (c) 2007 Miodrag Vallat.
*
@@ -293,12 +293,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
index ed2c256b29c..d560a1b7c58 100644
--- a/sys/arch/hp300/hp300/machdep.c
+++ b/sys/arch/hp300/hp300/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.120 2008/06/27 17:22:14 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.121 2009/06/03 21:30:19 beck Exp $ */
/* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */
/*
@@ -290,12 +290,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index 58188d3c89d..f7c0af3f823 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.171 2009/02/14 18:51:03 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.172 2009/06/03 21:30:19 beck Exp $ */
/*
* Copyright (c) 1999-2003 Michael Shalayeff
@@ -653,12 +653,6 @@ cpu_startup(void)
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c
index 3794891ae17..e3385e60162 100644
--- a/sys/arch/hppa64/hppa64/machdep.c
+++ b/sys/arch/hppa64/hppa64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.13 2009/02/04 17:19:17 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.14 2009/06/03 21:30:19 beck Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -406,12 +406,6 @@ cpu_startup(void)
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
printf("here3\n");
/*
* Allocate a submap for exec arguments. This map effectively
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index b255c2bf145..ad3a266aa0f 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.451 2009/06/03 00:41:48 weingart Exp $ */
+/* $OpenBSD: machdep.c,v 1.452 2009/06/03 21:30:19 beck Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -547,11 +547,6 @@ setup_buffers()
if (bufpages == 0)
bufpages = atop(avail_end) * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
}
/*
diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c
index 79be85bbecc..27a6f7ae066 100644
--- a/sys/arch/luna88k/luna88k/machdep.c
+++ b/sys/arch/luna88k/luna88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.62 2009/04/19 17:56:13 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.63 2009/06/03 21:30:19 beck Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -470,12 +470,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c
index 3eb2c4d2ea9..a86c163e416 100644
--- a/sys/arch/mac68k/mac68k/machdep.c
+++ b/sys/arch/mac68k/mac68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.147 2008/11/09 12:34:47 tobias Exp $ */
+/* $OpenBSD: machdep.c,v 1.148 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */
/*
@@ -419,12 +419,6 @@ cpu_startup(void)
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index bf30d430a40..b337075e78e 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.105 2009/06/02 21:38:09 drahn Exp $ */
+/* $OpenBSD: machdep.c,v 1.106 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -509,12 +509,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c
index 206d606a0da..836bec8ec95 100644
--- a/sys/arch/mvme68k/mvme68k/machdep.c
+++ b/sys/arch/mvme68k/mvme68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.114 2009/03/15 20:40:25 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.115 2009/06/03 21:30:20 beck Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -265,12 +265,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index ef4828c388a..32c28247423 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.229 2009/04/19 17:56:13 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.230 2009/06/03 21:30:20 beck Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -404,12 +404,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/mvmeppc/mvmeppc/machdep.c b/sys/arch/mvmeppc/mvmeppc/machdep.c
index ba2f1a3ae1d..42da01b655a 100644
--- a/sys/arch/mvmeppc/mvmeppc/machdep.c
+++ b/sys/arch/mvmeppc/mvmeppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.56 2008/04/09 16:58:10 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.57 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -415,12 +415,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c
index db730e18e6d..79a4121064d 100644
--- a/sys/arch/sgi/sgi/machdep.c
+++ b/sys/arch/sgi/sgi/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.70 2009/05/28 18:03:55 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.71 2009/06/03 21:30:20 beck Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -771,12 +771,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm. */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/socppc/socppc/machdep.c b/sys/arch/socppc/socppc/machdep.c
index 1743306806d..e9b77c46f97 100644
--- a/sys/arch/socppc/socppc/machdep.c
+++ b/sys/arch/socppc/socppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.10 2009/06/02 21:38:10 drahn Exp $ */
+/* $OpenBSD: machdep.c,v 1.11 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -772,12 +772,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/solbourne/solbourne/machdep.c b/sys/arch/solbourne/solbourne/machdep.c
index 5e240c0c371..cc3e64cf9a7 100644
--- a/sys/arch/solbourne/solbourne/machdep.c
+++ b/sys/arch/solbourne/solbourne/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.8 2009/02/04 17:19:17 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.9 2009/06/03 21:30:20 beck Exp $ */
/* OpenBSD: machdep.c,v 1.105 2005/04/11 15:13:01 deraadt Exp */
/*
@@ -190,12 +190,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index a0dfdd414c1..ea63610774f 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.116 2008/06/27 17:22:15 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.117 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -203,12 +203,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c
index 1eaa5fb3ac9..fd9433bcbba 100644
--- a/sys/arch/vax/vax/machdep.c
+++ b/sys/arch/vax/vax/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.99 2008/08/18 23:19:29 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.100 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */
/*
@@ -212,12 +212,6 @@ cpu_startup()
if (bufpages == 0)
bufpages = physmem * bufcachepercent / 100;
- /* Restrict to at most 25% filled kvm */
- if (bufpages >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / PAGE_SIZE / 4)
- bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- PAGE_SIZE / 4;
-
/*
* Allocate a submap for exec arguments. This map effectively limits
* the number of processes exec'ing at any time.
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 322816d1090..19112eff659 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.169 2009/04/19 17:53:38 deraadt Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.170 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -535,6 +535,23 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case KERN_CPTIME2:
return (sysctl_cptime2(name + 1, namelen -1, oldp, oldlenp,
newp, newlen));
+ case KERN_CACHEPCT: {
+ int opct, pgs;
+ opct = bufcachepercent;
+ error = sysctl_int(oldp, oldlenp, newp, newlen,
+ &bufcachepercent);
+ if (error)
+ return(error);
+ if (bufcachepercent > 90 || bufcachepercent < 5) {
+ bufcachepercent = opct;
+ return (EINVAL);
+ }
+ if (bufcachepercent != opct) {
+ pgs = bufcachepercent * physmem / 100;
+ bufadjust(pgs);
+ }
+ return(0);
+ }
default:
return (EOPNOTSUPP);
}
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 6706e7262a9..c106a1a1b36 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_bio.c,v 1.113 2009/06/03 04:30:57 beck Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.114 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*-
@@ -235,6 +235,33 @@ bufinit(void)
maxcleanpages = locleanpages;
}
+/*
+ * Change cachepct
+ */
+void
+bufadjust(int newbufpages)
+{
+ /*
+ * XXX - note, bufkvm was allocated once, based on 10% of physmem
+ * see above.
+ */
+
+ bufpages = newbufpages;
+
+ hidirtypages = (bufpages / 4) * 3;
+ lodirtypages = bufpages / 2;
+
+ /*
+ * When we hit 95% of pages being clean, we bring them down to
+ * 90% to have some slack.
+ */
+ hicleanpages = bufpages - (bufpages / 20);
+ locleanpages = bufpages - (bufpages / 10);
+
+ maxcleanpages = locleanpages;
+}
+
+
struct buf *
bio_doread(struct vnode *vp, daddr64_t blkno, int size, int async)
{
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 0d515480cb6..5796fda878f 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.h,v 1.92 2009/06/03 14:45:55 jj Exp $ */
+/* $OpenBSD: mount.h,v 1.93 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */
/*
@@ -506,6 +506,8 @@ struct bcachestats {
#ifdef _KERNEL
extern struct bcachestats bcstats;
#define BUFPAGES_DEFICIT (bufpages - bcstats.numbufpages)
+extern int bufcachepercent;
+extern void bufadjust(int);
#endif
/*
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 19524fe8de0..21dde2bbf58 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.96 2009/04/19 17:53:39 deraadt Exp $ */
+/* $OpenBSD: sysctl.h,v 1.97 2009/06/03 21:30:20 beck Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -184,7 +184,8 @@ struct ctlname {
#define KERN_TIMECOUNTER 69 /* node: timecounter */
#define KERN_MAXLOCKSPERUID 70 /* int: locks per uid */
#define KERN_CPTIME2 71 /* array: cp_time2 */
-#define KERN_MAXID 72 /* number of valid kern ids */
+#define KERN_CACHEPCT 72 /* buffer cache % of physmem */
+#define KERN_MAXID 73 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
{ 0, 0 }, \
@@ -259,6 +260,7 @@ struct ctlname {
{ "timecounter", CTLTYPE_NODE }, \
{ "maxlocksperuid", CTLTYPE_INT }, \
{ "cp_time2", CTLTYPE_STRUCT }, \
+ { "bufcachepercent", CTLTYPE_INT }, \
}
/*