From: deraadt Date: Sat, 14 Dec 1996 15:37:16 +0000 (+0000) Subject: clamp kvm useage X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7382dee6b55ac08fec34f2323bb364841bb0388d;p=openbsd clamp kvm useage --- 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)