PERFORCE change 126405 for review

Kip Macy kmacy at FreeBSD.org
Fri Sep 14 12:03:21 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126405

Change 126405 by kmacy at 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
  *


More information about the p4-projects mailing list