summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1996-01-29 11:12:37 +0000
committerdg <dg@FreeBSD.org>1996-01-29 11:12:37 +0000
commit33311f68ed38927b533fee23f40e97913c8f372b (patch)
tree12adde0e0c0831e8af98cc50f35b606aa7b3ced0 /sys/kern/kern_malloc.c
parentbc2512f99f2695dc10abcf0a7ba23988230e5792 (diff)
downloadFreeBSD-src-33311f68ed38927b533fee23f40e97913c8f372b.zip
FreeBSD-src-33311f68ed38927b533fee23f40e97913c8f372b.tar.gz
Implement what I mentioned in rev 1.18: limit per-bucket allocations to
60% of physical memory or 60% of malloc area size, whichever is smaller.
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 185d497..033d913 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
- * $Id: kern_malloc.c,v 1.17 1995/12/14 08:31:28 phk Exp $
+ * $Id: kern_malloc.c,v 1.18 1996/01/29 09:58:34 davidg Exp $
*/
#include <sys/param.h>
@@ -395,9 +395,13 @@ kmeminit(dummy)
bucket[indx].kb_elmpercl = CLBYTES / (1 << indx);
bucket[indx].kb_highwat = 5 * bucket[indx].kb_elmpercl;
}
+ /*
+ * Limit maximum memory for each type to 60% of malloc area size or
+ * 60% of physical memory, whichever is smaller.
+ */
for (indx = 0; indx < M_LAST; indx++) {
- kmemstats[indx].ks_limit = (npg * PAGE_SIZE -
- nmbclusters * MCLBYTES) * 6 / 10;
+ kmemstats[indx].ks_limit = min(cnt.v_page_count * PAGE_SIZE,
+ (npg * PAGE_SIZE - nmbclusters * MCLBYTES)) * 6 / 10;
}
#endif
}
OpenPOWER on IntegriCloud