==== //depot/vendor/freebsd/src/sys/vm/uma.h#31 (text+ko) - //depot/projects/ethng/src/sys/vm/uma.h#2 (text+ko) ==== content @@ -482,6 +482,7 @@ */ void uma_zone_set_freef(uma_zone_t zone, uma_free freef); +void uma_zone_set_contig(uma_zone_t zone); /* * These flags are setable in the allocf and visable in the freef. ==== //depot/vendor/freebsd/src/sys/vm/uma_core.c#148 (text+ko) - //depot/projects/ethng/src/sys/vm/uma_core.c#3 (text+ko) ==== content @@ -957,6 +957,32 @@ return (p); } +static void * +uma_zone_contig_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +{ + int malloc_flags; + + *flags = UMA_SLAB_PRIV; + malloc_flags = (wait ? M_WAITOK : M_NOWAIT); + + return (contigmalloc(bytes, M_DEVBUF, malloc_flags, 0x0ULL, + (vm_paddr_t)-1, 1, 0)); +} + +static void +uma_zone_contig_free(void *mem, int size, u_int8_t flags) +{ + contigfree(mem, size, M_DEVBUF); +} + +void +uma_zone_set_contig(uma_zone_t zone) +{ + uma_zone_set_allocf(zone, uma_zone_contig_alloc); + uma_zone_set_freef(zone, uma_zone_contig_free); + +} + /* * Allocates a number of pages from within an object * ==== //depot/vendor/freebsd/src/sys/vm/vm_contig.c#63 (text+ko) - //depot/projects/ethng/src/sys/vm/vm_contig.c#3 (text+ko) ==== content @@ -183,7 +183,8 @@ vm_page_unlock_queues(); } -static void * +#ifndef VM_MD_CONTIG +void * contigmalloc2(vm_page_t m, vm_pindex_t npages, int flags) { vm_object_t object = kernel_object; @@ -220,6 +221,17 @@ return ((void *)addr); } +void +contigfree(void *addr, unsigned long size, struct malloc_type *type) +{ + vm_pindex_t npgs; + + npgs = round_page(size) >> PAGE_SHIFT; + kmem_free(kernel_map, (vm_offset_t)addr, size); + malloc_type_freed(type, npgs << PAGE_SHIFT); +} +#endif + void * contigmalloc( unsigned long size, /* should be size_t here and for malloc() */ @@ -271,12 +283,3 @@ return (ret); } -void -contigfree(void *addr, unsigned long size, struct malloc_type *type) -{ - vm_pindex_t npgs; - - npgs = round_page(size) >> PAGE_SHIFT; - kmem_free(kernel_map, (vm_offset_t)addr, size); - malloc_type_freed(type, npgs << PAGE_SHIFT); -} ==== //depot/vendor/freebsd/src/sys/vm/vm_extern.h#33 (text+ko) - //depot/projects/ethng/src/sys/vm/vm_extern.h#3 (text+ko) ==== content @@ -96,5 +96,7 @@ int vm_thread_new_altkstack(struct thread *td, int pages); void vm_thread_swapin(struct thread *td); void vm_thread_swapout(struct thread *td); + +void *contigmalloc2(vm_page_t m, vm_pindex_t npages, int flags); #endif /* _KERNEL */ #endif /* !_VM_EXTERN_H_ */