diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 17 | ||||
-rw-r--r-- | sys/conf/param.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 17 | ||||
-rw-r--r-- | sys/kern/subr_param.c | 4 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 4 | ||||
-rw-r--r-- | sys/vm/vm_kern.c | 14 | ||||
-rw-r--r-- | sys/vm/vm_kern.h | 2 |
7 files changed, 25 insertions, 37 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 912d392..4cf3ac8 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -344,16 +344,15 @@ again: * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(nmbclusters+PAGE_SIZE/MCLBYTES, - M_MBUF, M_NOWAIT); - bzero(mclrefcnt, nmbclusters+PAGE_SIZE/MCLBYTES); - mcl_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr, - nmbclusters * MCLBYTES, FALSE); { - vm_size_t mb_map_size; - mb_map_size = nmbufs * MSIZE; - mb_map = kmem_suballoc(kmem_map, &minaddr, &maxaddr, - round_page(mb_map_size), FALSE); + vm_offset_t mb_map_size; + + mb_map_size = nmbufs * MSIZE + nmbclusters * MCLBYTES; + mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE)); + mclrefcnt = malloc(mb_map_size / MCLBYTES, M_MBUF, M_NOWAIT); + bzero(mclrefcnt, mb_map_size / MCLBYTES); + mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr, + mb_map_size, FALSE); } /* diff --git a/sys/conf/param.c b/sys/conf/param.c index 209f8ef..3738a58 100644 --- a/sys/conf/param.c +++ b/sys/conf/param.c @@ -100,8 +100,8 @@ int extravnodes = EXTRAVNODES; /* spare vnodes to allocate */ #endif int nmbclusters = NMBCLUSTERS; -/* allocate same amount of virtual address space for mbufs XXX */ -int nmbufs = NMBCLUSTERS * (MCLBYTES / MSIZE); +/* allocate 1/4th amount of virtual address space for mbufs XXX */ +int nmbufs = NMBCLUSTERS * 4; int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 912d392..4cf3ac8 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -344,16 +344,15 @@ again: * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(nmbclusters+PAGE_SIZE/MCLBYTES, - M_MBUF, M_NOWAIT); - bzero(mclrefcnt, nmbclusters+PAGE_SIZE/MCLBYTES); - mcl_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr, - nmbclusters * MCLBYTES, FALSE); { - vm_size_t mb_map_size; - mb_map_size = nmbufs * MSIZE; - mb_map = kmem_suballoc(kmem_map, &minaddr, &maxaddr, - round_page(mb_map_size), FALSE); + vm_offset_t mb_map_size; + + mb_map_size = nmbufs * MSIZE + nmbclusters * MCLBYTES; + mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE)); + mclrefcnt = malloc(mb_map_size / MCLBYTES, M_MBUF, M_NOWAIT); + bzero(mclrefcnt, mb_map_size / MCLBYTES); + mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr, + mb_map_size, FALSE); } /* diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index 209f8ef..3738a58 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -100,8 +100,8 @@ int extravnodes = EXTRAVNODES; /* spare vnodes to allocate */ #endif int nmbclusters = NMBCLUSTERS; -/* allocate same amount of virtual address space for mbufs XXX */ -int nmbufs = NMBCLUSTERS * (MCLBYTES / MSIZE); +/* allocate 1/4th amount of virtual address space for mbufs XXX */ +int nmbufs = NMBCLUSTERS * 4; int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 9c93c4a..3f99385 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -150,11 +150,11 @@ m_clalloc(ncl, nowait) * to get any more (nothing is ever freed back to the * map). */ - if (mcl_map_full) + if (mb_map_full) return (0); npg = ncl; - p = (caddr_t)kmem_malloc(mcl_map, ctob(npg), + p = (caddr_t)kmem_malloc(mb_map, ctob(npg), nowait ? M_NOWAIT : M_WAITOK); /* * Either the map is now full, or this is nowait and there diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 7ca36f9..5d8c00d 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -98,8 +98,6 @@ vm_map_t u_map=0; vm_map_t buffer_map=0; vm_map_t mb_map=0; int mb_map_full=0; -vm_map_t mcl_map=0; -int mcl_map_full=0; vm_map_t io_map=0; vm_map_t phys_map=0; @@ -289,8 +287,8 @@ kmem_malloc(map, size, waitflag) vm_offset_t addr; vm_page_t m; - if (map != kmem_map && map != mb_map && map != mcl_map) - panic("kmem_malloc: map != {kmem,mb,mcl}_map"); + if (map != kmem_map && map != mb_map) + panic("kmem_malloc: map != {kmem,mb}_map"); size = round_page(size); addr = vm_map_min(map); @@ -305,13 +303,7 @@ kmem_malloc(map, size, waitflag) vm_map_unlock(map); if (map == mb_map) { mb_map_full = TRUE; - log(LOG_ERR, "Out of mbufs - increase maxusers!\n"); - return (0); - } - if (map == mcl_map) { - mcl_map_full = TRUE; - log(LOG_ERR, - "Out of mbuf clusters - increase maxusers!\n"); + log(LOG_ERR, "Out of mbuf clusters - increase maxusers!\n"); return (0); } if (waitflag == M_WAITOK) diff --git a/sys/vm/vm_kern.h b/sys/vm/vm_kern.h index 602630f..32f924b 100644 --- a/sys/vm/vm_kern.h +++ b/sys/vm/vm_kern.h @@ -73,8 +73,6 @@ extern vm_map_t kernel_map; extern vm_map_t kmem_map; extern vm_map_t mb_map; extern int mb_map_full; -extern vm_map_t mcl_map; -extern int mcl_map_full; extern vm_map_t io_map; extern vm_map_t clean_map; extern vm_map_t phys_map; |