Date: Fri, 14 Sep 2007 19:03:20 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 126405 for review Message-ID: <200709141903.l8EJ3KCm022786@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=126405 Change 126405 by kmacy@kmacy_home:ethng on 2007/09/14 19:02:21 122915 - add contiguous allocator for UMA Affected files ... .. //depot/projects/ethng/src/sys/vm/uma.h#2 edit .. //depot/projects/ethng/src/sys/vm/uma_core.c#2 edit Differences ... ==== //depot/projects/ethng/src/sys/vm/uma.h#2 (text+ko) ==== @@ -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/projects/ethng/src/sys/vm/uma_core.c#2 (text+ko) ==== @@ -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 *
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709141903.l8EJ3KCm022786>