summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1996-05-10 19:28:55 +0000
committerwollman <wollman@FreeBSD.org>1996-05-10 19:28:55 +0000
commita28a8481af3f2a2145d2a6c164a6299934c2bb3f (patch)
treefab5023c844a9f8148e7c028b3bd0bc0cb934ed5 /sys/kern/kern_malloc.c
parent32706d589a389e3534278d9dec0d4dc6fbacbeca (diff)
downloadFreeBSD-src-a28a8481af3f2a2145d2a6c164a6299934c2bb3f.zip
FreeBSD-src-a28a8481af3f2a2145d2a6c164a6299934c2bb3f.tar.gz
Allocate mbufs from a separate submap so that NMBCLUSTERS works as
expected.
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index bfdc4bb..b348a3c 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.20 1996/05/02 10:43:17 phk Exp $
+ * $Id: kern_malloc.c,v 1.21 1996/05/02 14:20:20 phk Exp $
*/
#include <sys/param.h>
@@ -372,15 +372,16 @@ kmeminit(dummy)
int npg;
#if ((MAXALLOCSAVE & (MAXALLOCSAVE - 1)) != 0)
- ERROR!_kmeminit:_MAXALLOCSAVE_not_power_of_2
+#error "kmeminit: MAXALLOCSAVE not power of 2"
#endif
#if (MAXALLOCSAVE > MINALLOCSIZE * 32768)
- ERROR!_kmeminit:_MAXALLOCSAVE_too_big
+#error "kmeminit: MAXALLOCSAVE too big"
#endif
#if (MAXALLOCSAVE < PAGE_SIZE)
- ERROR!_kmeminit:_MAXALLOCSAVE_too_small
+#error "kmeminit: MAXALLOCSAVE too small"
#endif
- npg = (nmbclusters * MCLBYTES + VM_KMEM_SIZE) / PAGE_SIZE;
+ npg = (nmbufs * MSIZE + nmbclusters * MCLBYTES + VM_KMEM_SIZE)
+ / PAGE_SIZE;
kmemusage = (struct kmemusage *) kmem_alloc(kernel_map,
(vm_size_t)(npg * sizeof(struct kmemusage)));
@@ -401,7 +402,8 @@ kmeminit(dummy)
*/
for (indx = 0; indx < M_LAST; indx++) {
kmemstats[indx].ks_limit = min(cnt.v_page_count * PAGE_SIZE,
- (npg * PAGE_SIZE - nmbclusters * MCLBYTES)) * 6 / 10;
+ (npg * PAGE_SIZE - nmbclusters * MCLBYTES
+ - nmbufs * MSIZE)) * 6 / 10;
}
#endif
}
OpenPOWER on IntegriCloud