diff options
-rw-r--r-- | sys/kern/kern_malloc.c | 4 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 9 | ||||
-rw-r--r-- | sys/sys/mbuf.h | 1 |
3 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index a6447a5..ad0d0e9 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -475,8 +475,8 @@ kmeminit(dummy) if ((vm_kmem_size / 2) > (cnt.v_page_count * PAGE_SIZE)) vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE; - npg = (nmbufs * MSIZE + nmbclusters * MCLBYTES + vm_kmem_size) - / PAGE_SIZE; + npg = (nmbufs * MSIZE + nmbclusters * MCLBYTES + nmbcnt * + sizeof(union mext_refcnt) + vm_kmem_size) / PAGE_SIZE; kmemusage = (struct kmemusage *) kmem_alloc(kernel_map, (vm_size_t)(npg * sizeof(struct kmemusage))); diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 35414b1..70bbc45 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -121,14 +121,15 @@ static void m_reclaim(void); static void mbinit(void *dummy) { - vm_offset_t maxaddr, mb_map_size; + vm_offset_t maxaddr; + vm_size_t mb_map_size; /* * Setup the mb_map, allocate requested VM space. */ - mb_map_size = nmbufs * MSIZE + nmbclusters * MCLBYTES + nmbcnt - * sizeof(union mext_refcnt); - mb_map_size = roundup2(mb_map_size, PAGE_SIZE); + mb_map_size = (vm_size_t)(nmbufs * MSIZE + nmbclusters * MCLBYTES + + nmbcnt * sizeof(union mext_refcnt)); + mb_map_size = rounddown(mb_map_size, PAGE_SIZE); mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr, mb_map_size); /* XXX XXX XXX: mb_map->system_map = 1; */ diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index fcbe15a..f904ade 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -666,6 +666,7 @@ extern struct mclfree_lst mclfree; extern struct mcntfree_lst mcntfree; extern struct mbffree_lst mmbfree; extern int nmbclusters; +extern int nmbcnt; extern int nmbufs; extern int nsfbufs; |