Provide an alternative interface to contigmalloc() which allows a specific

map to be used when allocating the kernel va (e.g., mb_map).  The VM
gurus may want to look this over.
This commit is contained in:
Garrett Wollman 1997-02-13 19:37:40 +00:00
parent c65c314e66
commit 10825343b0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=22670
2 changed files with 22 additions and 4 deletions

View File

@ -81,5 +81,8 @@ extern vm_map_t exech_map;
extern vm_map_t u_map;
extern vm_offset_t kernel_vm_end;
/* XXX - elsewhere? */
extern void *contigmalloc1(u_long, int, int, u_long, u_long, u_long, u_long,
vm_map_t);
#endif /* _VM_VM_KERN_H_ */

View File

@ -1271,7 +1271,7 @@ vm_page_test_dirty(m)
* for statistics and for allocations of less than a page.
*/
void *
contigmalloc(size, type, flags, low, high, alignment, boundary)
contigmalloc1(size, type, flags, low, high, alignment, boundary, map)
unsigned long size; /* should be size_t here and for malloc() */
int type;
int flags;
@ -1279,6 +1279,7 @@ contigmalloc(size, type, flags, low, high, alignment, boundary)
unsigned long high;
unsigned long alignment;
unsigned long boundary;
vm_map_t map;
{
int i, s, start;
vm_offset_t addr, phys, tmp_addr;
@ -1429,7 +1430,7 @@ contigmalloc(size, type, flags, low, high, alignment, boundary)
* Allocate kernel VM, unfree and assign the physical pages to it and
* return kernel VM pointer.
*/
tmp_addr = addr = kmem_alloc_pageable(kernel_map, size);
tmp_addr = addr = kmem_alloc_pageable(map, size);
if (addr == 0) {
/*
* XXX We almost never run out of kernel virtual
@ -1454,6 +1455,20 @@ contigmalloc(size, type, flags, low, high, alignment, boundary)
return NULL;
}
void *
contigmalloc(size, type, flags, low, high, alignment, boundary)
unsigned long size; /* should be size_t here and for malloc() */
int type;
int flags;
unsigned long low;
unsigned long high;
unsigned long alignment;
unsigned long boundary;
{
return contigmalloc1(size, type, flags, low, high, alignment, boundary,
kernel_map);
}
vm_offset_t
vm_page_alloc_contig(size, low, high, alignment)
vm_offset_t size;
@ -1461,8 +1476,8 @@ vm_page_alloc_contig(size, low, high, alignment)
vm_offset_t high;
vm_offset_t alignment;
{
return ((vm_offset_t)contigmalloc(size, M_DEVBUF, M_NOWAIT, low, high,
alignment, 0ul));
return ((vm_offset_t)contigmalloc1(size, M_DEVBUF, M_NOWAIT, low, high,
alignment, 0ul, kernel_map));
}
#include "opt_ddb.h"