Date: Thu, 31 Oct 2002 20:35:35 -0800 (PST) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 20511 for review Message-ID: <200211010435.gA14ZZjO061764@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=20511 Change 20511 by peter@peter_daintree on 2002/10/31 20:35:16 initial version of cut/paste from alpha of the uma_small stuff Affected files ... .. //depot/projects/ia64/sys/ia64/ia64/pmap.c#42 edit Differences ... ==== //depot/projects/ia64/sys/ia64/ia64/pmap.c#42 (text+ko) ==== @@ -117,6 +117,7 @@ #include <vm/vm_pageout.h> #include <vm/vm_pager.h> #include <vm/uma.h> +#include <vm/uma_int.h> #include <sys/user.h> @@ -260,8 +261,6 @@ static void pmap_invalidate_all(pmap_t pmap); static void pmap_remove_all(vm_page_t m); static void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m); -static void *pmap_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait); -static void *pmap_allocf_r7(uma_zone_t zone, int bytes, u_int8_t *flags, int wait); vm_offset_t pmap_steal_memory(vm_size_t size) @@ -481,18 +480,40 @@ pmap_invalidate_all(kernel_pmap); } -static void * -pmap_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +void * +uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { + static vm_pindex_t color; + vm_page_t m; + int pflags; + void *va; + *flags = UMA_SLAB_PRIV; - return (void *)kmem_alloc(kernel_map, bytes); + if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT) + pflags = VM_ALLOC_INTERRUPT; + else + pflags = VM_ALLOC_SYSTEM; + if (wait & M_ZERO) + pflags |= VM_ALLOC_ZERO; + m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); + if (m) { + va = (void *)IA64_PHYS_TO_RR7(VM_PAGE_TO_PHYS(m)); + if ((m->flags & PG_ZERO) == 0) + bzero(va, PAGE_SIZE); + return (va); + } + return (NULL); } -static void * -pmap_allocf_r7(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +void +uma_small_free(void *mem, int size, u_int8_t flags) { - *flags = UMA_SLAB_PRIV; - return (void *)IA64_PHYS_TO_RR7(ia64_tpa(kmem_alloc(kernel_map, bytes))); + vm_page_t m; + + m = PHYS_TO_VM_PAGE(IA64_RR_MASK((u_int64_t)mem)); + vm_page_lock_queues(); + vm_page_free(m); + vm_page_unlock_queues(); } /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211010435.gA14ZZjO061764>