diff options
author | wollman <wollman@FreeBSD.org> | 1996-05-10 19:28:55 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1996-05-10 19:28:55 +0000 |
commit | a28a8481af3f2a2145d2a6c164a6299934c2bb3f (patch) | |
tree | fab5023c844a9f8148e7c028b3bd0bc0cb934ed5 /sys/kern | |
parent | 32706d589a389e3534278d9dec0d4dc6fbacbeca (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/kern/kern_malloc.c | 14 | ||||
-rw-r--r-- | sys/kern/subr_param.c | 10 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 6 |
3 files changed, 17 insertions, 13 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 } diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index da221c8..f86e749 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.c 8.3 (Berkeley) 8/20/94 - * $Id: param.c,v 1.17 1996/05/02 10:42:51 phk Exp $ + * $Id: param.c,v 1.18 1996/05/02 14:19:18 phk Exp $ */ #include "opt_sysvipc.h" @@ -91,10 +91,12 @@ int ncallout = 16 + NPROC; /* maximum # of timer events */ /* maximum # of mbuf clusters */ #ifndef NMBCLUSTERS -int nmbclusters = 512 + MAXUSERS * 16; -#else -int nmbclusters = NMBCLUSTERS; +#define NMBCLUSTERS (512 + MAXUSERS * 16) #endif +int nmbclusters = NMBCLUSTERS; + +/* allocate same amount of virtual address space for mbufs XXX */ +int nmbufs = NMBCLUSTERS * (MCLBYTES / MSIZE); int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 9c2d315..f742628 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 - * $Id: uipc_mbuf.c,v 1.19 1996/05/06 17:18:12 phk Exp $ + * $Id: uipc_mbuf.c,v 1.20 1996/05/08 19:38:14 wollman Exp $ */ #include <sys/param.h> @@ -152,11 +152,11 @@ m_clalloc(ncl, nowait) * to get any more (nothing is ever freed back to the * map). */ - if (mb_map_full) + if (mcl_map_full) return (0); npg = ncl; - p = (caddr_t)kmem_malloc(mb_map, ctob(npg), + p = (caddr_t)kmem_malloc(mcl_map, ctob(npg), nowait ? M_NOWAIT : M_WAITOK); /* * Either the map is now full, or this is nowait and there |