diff options
author | jeff <jeff@FreeBSD.org> | 2013-08-07 06:21:20 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2013-08-07 06:21:20 +0000 |
commit | de4ecca21340ce4d0bf9182cac133c14e031218e (patch) | |
tree | 950bad07f0aeeeae78036d82b9aa11ae998c3654 /sys/mips/mips | |
parent | e141f5c0bac3839e4886a26e1ba796f4e46e6455 (diff) | |
download | FreeBSD-src-de4ecca21340ce4d0bf9182cac133c14e031218e.zip FreeBSD-src-de4ecca21340ce4d0bf9182cac133c14e031218e.tar.gz |
Replace kernel virtual address space allocation with vmem. This provides
transparent layering and better fragmentation.
- Normalize functions that allocate memory to use kmem_*
- Those that allocate address space are named kva_*
- Those that operate on maps are named kmap_*
- Implement recursive allocation handling for kmem_arena in vmem.
Reviewed by: alc
Tested by: pho
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/mips/mips')
-rw-r--r-- | sys/mips/mips/mp_machdep.c | 3 | ||||
-rw-r--r-- | sys/mips/mips/pmap.c | 19 | ||||
-rw-r--r-- | sys/mips/mips/vm_machdep.c | 2 |
3 files changed, 5 insertions, 19 deletions
diff --git a/sys/mips/mips/mp_machdep.c b/sys/mips/mips/mp_machdep.c index 88c2357..2a6bbb4 100644 --- a/sys/mips/mips/mp_machdep.c +++ b/sys/mips/mips/mp_machdep.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include <sys/ktr.h> #include <sys/proc.h> #include <sys/lock.h> +#include <sys/malloc.h> #include <sys/mutex.h> #include <sys/kernel.h> #include <sys/pcpu.h> @@ -182,7 +183,7 @@ start_ap(int cpuid) int cpus, ms; cpus = mp_naps; - dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE); + dpcpu = (void *)kmem_malloc(kernel_arena, DPCPU_SIZE, M_WAITOK | M_ZERO); mips_sync(); diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c index 3ef5186..48efb06 100644 --- a/sys/mips/mips/pmap.c +++ b/sys/mips/mips/pmap.c @@ -3015,7 +3015,7 @@ pmap_mapdev(vm_paddr_t pa, vm_size_t size) offset = pa & PAGE_MASK; size = roundup(size + offset, PAGE_SIZE); - va = kmem_alloc_nofault(kernel_map, size); + va = kva_alloc(size); if (!va) panic("pmap_mapdev: Couldn't alloc kernel virtual memory"); pa = trunc_page(pa); @@ -3043,7 +3043,7 @@ pmap_unmapdev(vm_offset_t va, vm_size_t size) base = trunc_page(va); offset = va & PAGE_MASK; size = roundup(size + offset, PAGE_SIZE); - kmem_free(kernel_map, base, size); + kva_free(base, size); #endif } @@ -3149,21 +3149,6 @@ pmap_align_superpage(vm_object_t object, vm_ooffset_t offset, *addr = ((*addr + SEGMASK) & ~SEGMASK) + superpage_offset; } -/* - * Increase the starting virtual address of the given mapping so - * that it is aligned to not be the second page in a TLB entry. - * This routine assumes that the length is appropriately-sized so - * that the allocation does not share a TLB entry at all if required. - */ -void -pmap_align_tlb(vm_offset_t *addr) -{ - if ((*addr & PAGE_SIZE) == 0) - return; - *addr += PAGE_SIZE; - return; -} - #ifdef DDB DB_SHOW_COMMAND(ptable, ddb_pid_dump) { diff --git a/sys/mips/mips/vm_machdep.c b/sys/mips/mips/vm_machdep.c index 0323bb3..86dfde9 100644 --- a/sys/mips/mips/vm_machdep.c +++ b/sys/mips/mips/vm_machdep.c @@ -514,7 +514,7 @@ sf_buf_init(void *arg) mtx_init(&sf_freelist.sf_lock, "sf_bufs list lock", NULL, MTX_DEF); SLIST_INIT(&sf_freelist.sf_head); - sf_base = kmem_alloc_nofault(kernel_map, nsfbufs * PAGE_SIZE); + sf_base = kva_alloc(nsfbufs * PAGE_SIZE); sf_bufs = malloc(nsfbufs * sizeof(struct sf_buf), M_TEMP, M_NOWAIT | M_ZERO); for (i = 0; i < nsfbufs; i++) { |