summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authorbmilekic <bmilekic@FreeBSD.org>2001-04-18 23:54:13 +0000
committerbmilekic <bmilekic@FreeBSD.org>2001-04-18 23:54:13 +0000
commitb857e0ac23e8df79e651abe8d55750dd0222d610 (patch)
tree5f899951e7da5db6ca7128cfcb735510070b4918 /sys/kern/kern_malloc.c
parentf4abc7a864b571322f61de55ab201b41a046a462 (diff)
downloadFreeBSD-src-b857e0ac23e8df79e651abe8d55750dd0222d610.zip
FreeBSD-src-b857e0ac23e8df79e651abe8d55750dd0222d610.tar.gz
Fix inconsistency in setup of kernel_map: we need to make sure that
we also reserve _adequate_ space for the mb_map submap; i.e. we need space for nmbclusters, nmbufs, _and_ nmbcnt. Furthermore, we need to rounddown, and not roundup, so that we are consistent. Pointed out by: bde
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c4
1 files changed, 2 insertions, 2 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)));
OpenPOWER on IntegriCloud