PERFORCE change 122915 for review

Kip Macy kmacy at FreeBSD.org
Thu Jul 5 07:30:13 UTC 2007


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

Change 122915 by kmacy at kmacy_vt-x:opentoe_init on 2007/07/05 07:29:17

	add interface to support physically contiguous backend allocator
	for zones

Affected files ...

.. //depot/projects/opentoe/sys/vm/uma.h#2 edit
.. //depot/projects/opentoe/sys/vm/uma_core.c#4 edit

Differences ...

==== //depot/projects/opentoe/sys/vm/uma.h#2 (text+ko) ====

@@ -483,6 +483,8 @@
 
 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/opentoe/sys/vm/uma_core.c#4 (text+ko) ====

@@ -957,6 +957,31 @@
 	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,
+		0xffffffffffffULL, 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