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/ofed/include | |
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/ofed/include')
-rw-r--r-- | sys/ofed/include/linux/dma-mapping.h | 4 | ||||
-rw-r--r-- | sys/ofed/include/linux/gfp.h | 10 | ||||
-rw-r--r-- | sys/ofed/include/linux/linux_compat.c | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/sys/ofed/include/linux/dma-mapping.h b/sys/ofed/include/linux/dma-mapping.h index c653524..0f0ad9d 100644 --- a/sys/ofed/include/linux/dma-mapping.h +++ b/sys/ofed/include/linux/dma-mapping.h @@ -130,7 +130,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, else high = BUS_SPACE_MAXADDR_32BIT; align = PAGE_SIZE << get_order(size); - mem = (void *)kmem_alloc_contig(kmem_map, size, flag, 0, high, align, + mem = (void *)kmem_alloc_contig(kmem_arena, size, flag, 0, high, align, 0, VM_MEMATTR_DEFAULT); if (mem) *dma_handle = vtophys(mem); @@ -144,7 +144,7 @@ dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle) { - kmem_free(kmem_map, (vm_offset_t)cpu_addr, size); + kmem_free(kmem_arena, (vm_offset_t)cpu_addr, size); } /* XXX This only works with no iommu. */ diff --git a/sys/ofed/include/linux/gfp.h b/sys/ofed/include/linux/gfp.h index 8c36c15..8d2b228 100644 --- a/sys/ofed/include/linux/gfp.h +++ b/sys/ofed/include/linux/gfp.h @@ -65,7 +65,7 @@ static inline unsigned long _get_page(gfp_t mask) { - return kmem_malloc(kmem_map, PAGE_SIZE, mask); + return kmem_malloc(kmem_arena, PAGE_SIZE, mask); } #define get_zeroed_page(mask) _get_page((mask) | M_ZERO) @@ -78,7 +78,7 @@ free_page(unsigned long page) if (page == 0) return; - kmem_free(kmem_map, page, PAGE_SIZE); + kmem_free(kmem_arena, page, PAGE_SIZE); } static inline void @@ -88,7 +88,7 @@ __free_page(struct page *m) if (m->object != kmem_object) panic("__free_page: Freed page %p not allocated via wrappers.", m); - kmem_free(kmem_map, (vm_offset_t)page_address(m), PAGE_SIZE); + kmem_free(kmem_arena, (vm_offset_t)page_address(m), PAGE_SIZE); } static inline void @@ -99,7 +99,7 @@ __free_pages(void *p, unsigned int order) if (p == 0) return; size = PAGE_SIZE << order; - kmem_free(kmem_map, (vm_offset_t)p, size); + kmem_free(kmem_arena, (vm_offset_t)p, size); } /* @@ -114,7 +114,7 @@ alloc_pages(gfp_t gfp_mask, unsigned int order) size_t size; size = PAGE_SIZE << order; - page = kmem_alloc_contig(kmem_map, size, gfp_mask, 0, -1, + page = kmem_alloc_contig(kmem_arena, size, gfp_mask, 0, -1, size, 0, VM_MEMATTR_DEFAULT); if (page == 0) return (NULL); diff --git a/sys/ofed/include/linux/linux_compat.c b/sys/ofed/include/linux/linux_compat.c index 7167b1c..95bd6c8 100644 --- a/sys/ofed/include/linux/linux_compat.c +++ b/sys/ofed/include/linux/linux_compat.c @@ -647,7 +647,7 @@ vmap(struct page **pages, unsigned int count, unsigned long flags, int prot) size_t size; size = count * PAGE_SIZE; - off = kmem_alloc_nofault(kernel_map, size); + off = kva_alloc(size); if (off == 0) return (NULL); vmmap_add((void *)off, size); @@ -665,7 +665,7 @@ vunmap(void *addr) if (vmmap == NULL) return; pmap_qremove((vm_offset_t)addr, vmmap->vm_size / PAGE_SIZE); - kmem_free(kernel_map, (vm_offset_t)addr, vmmap->vm_size); + kva_free((vm_offset_t)addr, vmmap->vm_size); kfree(vmmap); } |