summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1997-02-01 00:31:50 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1997-02-01 00:31:50 +0000
commit6b03d90d3ab0f442805b2c7a3e60b38dc94162bd (patch)
treef7ef779e34ad60dabc3a38092946dbb2d68d836b
parentc9fff73aa8ef985120e6ea84008f89325783e798 (diff)
Allow bufpages/nbuf larger than 1 (still max out at all buffers
be MAXBSIZE). Remove faulty limit test of buffer pages allocation. The check is now done at the bufpages+nbuf calculations.
-rw-r--r--sys/arch/i386/i386/machdep.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index ee7a6538052..922638f8e48 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.36 1997/01/27 22:47:59 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.37 1997/02/01 00:31:49 niklas Exp $ */
/* $NetBSD: machdep.c,v 1.202 1996/05/18 15:54:59 christos Exp $ */
/*-
@@ -243,9 +243,9 @@ cpu_startup()
base = bufpages / nbuf;
residual = bufpages % nbuf;
- if (base >= MAXBSIZE) {
+ if (base >= MAXBSIZE / CLBYTES) {
/* don't want to alloc more physical mem than needed */
- base = MAXBSIZE;
+ base = MAXBSIZE / CLBYTES;
residual = 0;
}
@@ -393,17 +393,22 @@ allocsys(v)
else
bufpages = (btoc(2 * 1024 * 1024) + 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;
}
+
+ /* 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 that fits into the buffers is senseless. */
+ if (bufpages > nbuf * MAXBSIZE / CLBYTES)
+ bufpages = nbuf * MAXBSIZE / CLBYTES;
+
if (nswbuf == 0) {
nswbuf = (nbuf / 2) &~ 1; /* force even */
if (nswbuf > 256)