mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
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
This commit is contained in:
parent
6ca111f0e8
commit
d04d50d1f7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75686
@ -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)));
|
||||
|
@ -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; */
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user