summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-14 15:37:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-14 15:37:17 +0000
commit6e357f3781a3a8148a086de0369435a850c7f81b (patch)
tree24b4e5787443fdc0722a8377222ff3f285be1920 /sys/arch/sparc
parentcf7b0390212aacc960029c5267c56ae1734db7c3 (diff)
clamp kvm useage
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/sparc/machdep.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index 03dc4fc1a3b..e2b195565b3 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -324,18 +324,30 @@ allocsys(v)
valloc(msqids, struct msqid_ds, msginfo.msgmni);
#endif
+#ifndef BUFCACHEPERCENT
+#define BUFCACHEPERCENT 5
+#endif
/*
* Determine how many buffers to allocate (enough to
* hold 5% of total physical memory, but at least 16).
* Allocate 1/2 as many swap buffer headers as file i/o buffers.
*/
if (bufpages == 0)
- bufpages = (physmem / 20) / CLSIZE;
+ bufpages = (physmem / ((100/BUFCACHEPERCENT) / CLSIZE));
+ /* Restrict to at most 70% filled kvm */
+ if (bufpages * MAXBSIZE >
+ (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) * 7 / 10)
+ bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
+ MAXBSIZE * 7 / 10;
if (nbuf == 0) {
nbuf = bufpages;
if (nbuf < 16)
nbuf = 16;
}
+#if defined(SUN4C) || defined(SUN4)
+ if ((CPU_ISSUN4C || CPU_ISSUN4) && nbuf > 200)
+ nbuf = 200;
+#endif
if (nswbuf == 0) {
nswbuf = (nbuf / 2) &~ 1; /* force even */
if (nswbuf > 256)