summaryrefslogtreecommitdiff
path: root/sys/arch/hp300
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-12-02 19:37:26 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-12-02 19:37:26 +0000
commit188437070fa202e98220a575e1a99e750e227650 (patch)
tree34f9aed2c9fb6ed834c52e6b5e7eccbc19847c30 /sys/arch/hp300
parentcf08959f7cb4e48515f5190c2ab6db9d6263c6ba (diff)
Make BUFCACHEPERCENT adjustable through UKC, like all other arches do.
(This means twice as less buffers on hp300 with unmodified GENERIC kernels now)
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r--sys/arch/hp300/hp300/machdep.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
index a5869c12a58..6d358d728f1 100644
--- a/sys/arch/hp300/hp300/machdep.c
+++ b/sys/arch/hp300/hp300/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.91 2004/03/10 23:02:53 tom Exp $ */
+/* $OpenBSD: machdep.c,v 1.92 2004/12/02 19:37:22 miod Exp $ */
/* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */
/*
@@ -112,11 +112,18 @@ int nbuf = NBUF;
#else
int nbuf = 0;
#endif
+
+#ifndef BUFCACHEPERCENT
+#define BUFCACHEPERCENT 5
+#endif
+
#ifdef BUFPAGES
int bufpages = BUFPAGES;
#else
int bufpages = 0;
#endif
+int bufcachepercent = BUFCACHEPERCENT;
+
int maxmem; /* max memory per process */
int physmem = MAXMEM; /* max supported memory, changes to actual */
/*
@@ -415,19 +422,27 @@ allocsys(v)
#endif
/*
- * Determine how many buffers to allocate. Since HPs tend
- * to be long on memory and short on disk speed, we allocate
- * more buffer space than the BSD standard of 10% of memory
- * for the first 2 Meg, 5% of the remaining. We just allocate
- * a flag 10%. Insure a minimum of 16 buffers.
+ * 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 / 10;
+ bufpages = physmem * bufcachepercent / 100;
if (nbuf == 0) {
nbuf = bufpages;
if (nbuf < 16)
nbuf = 16;
}
+ /* Restrict to at most 70% filled kvm */
+ if (nbuf * MAXBSIZE >
+ (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) * 7 / 10)
+ nbuf = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) /
+ MAXBSIZE * 7 / 10;
+
+ /* More buffer pages than fits into the buffers is senseless. */
+ if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE)
+ bufpages = nbuf * MAXBSIZE / PAGE_SIZE;
+
valloc(buf, struct buf, nbuf);
return (v);
}