diff options
author | 1997-02-24 12:50:28 +0000 | |
---|---|---|
committer | 1997-02-24 12:50:28 +0000 | |
commit | a5ad1470ac91bae4cbb5789c8e5ef1491468300b (patch) | |
tree | 6cc1d5941711f8801491e7d884d7301411e1eedb | |
parent | irc thing is dumb, and do not bother wasting effort screaming about ftp bounce attempts, just slaughter them (diff) | |
download | wireguard-openbsd-a5ad1470ac91bae4cbb5789c8e5ef1491468300b.tar.xz wireguard-openbsd-a5ad1470ac91bae4cbb5789c8e5ef1491468300b.zip |
implement BUFCACHEPERCENT and take care with kva space
-rw-r--r-- | sys/arch/powerpc/powerpc/machdep.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/arch/powerpc/powerpc/machdep.c b/sys/arch/powerpc/powerpc/machdep.c index fce1130babf..0eb035ec7fb 100644 --- a/sys/arch/powerpc/powerpc/machdep.c +++ b/sys/arch/powerpc/powerpc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.5 1997/02/05 01:33:54 rahnds Exp $ */ +/* $OpenBSD: machdep.c,v 1.6 1997/02/24 12:50:28 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -465,16 +465,29 @@ allocsys(v) valloc(msqids, struct msqid_ds, msginfo.msgmni); #endif +#ifndef BUFCACHEPERCENT +#define BUFCACHEPERCENT 5 +#endif /* * Decide on buffer space to use. */ if (bufpages == 0) - bufpages = (physmem / 20) / CLSIZE; + bufpages = (physmem / ((100/BUFCACHEPERCENT) / CLSIZE); 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 / CLBYTES) + bufpages = nbuf * MAXBSIZE / CLBYTES; + if (nswbuf == 0) { nswbuf = (nbuf / 2) & ~1; if (nswbuf > 256) |