Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Oct 2002 16:34:43 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 19105 for review
Message-ID:  <200210112334.g9BNYhWR049936@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=19105

Change 19105 by peter@peter_mckinley on 2002/10/11 16:34:04

	File off the rough edges.
	This should be just about committable.

Affected files ...

.. //depot/projects/ia64/sys/alpha/include/uma_machdep.h#1 add
.. //depot/projects/ia64/sys/arm/include/uma_machdep.h#1 add
.. //depot/projects/ia64/sys/i386/include/uma_machdep.h#1 add
.. //depot/projects/ia64/sys/ia64/ia64/uma_machdep.c#3 edit
.. //depot/projects/ia64/sys/ia64/include/uma_machdep.h#1 add
.. //depot/projects/ia64/sys/powerpc/include/uma_machdep.h#1 add
.. //depot/projects/ia64/sys/sparc64/include/uma_machdep.h#1 add
.. //depot/projects/ia64/sys/vm/uma_core.c#25 edit

Differences ...

==== //depot/projects/ia64/sys/ia64/ia64/uma_machdep.c#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/vm/uma_core.c,v 1.38 2002/09/28 17:15:33 phk Exp $
+ * $FreeBSD$
  */
 
 #include "opt_param.h"
@@ -52,6 +52,8 @@
 #include <vm/uma_int.h>
 #include <vm/uma_dbg.h>
 
+#include <machine/uma_machdep.h>
+
 /*
  * Allocates a number of pages from within an object
  *
@@ -68,46 +70,54 @@
  *	 already been allocated.
  */
 void *
-obj_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait);
-
-void *
-obj_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
+uma_zone_obj_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
 {
-	vm_offset_t zkva;
-	vm_offset_t retkva;
 	vm_page_t p;
 	int pages;
 
-	retkva = 0;
 	pages = zone->uz_pages;
+	if (bytes > PAGE_SIZE)
+		panic("uma_zone_obj_alloc: %d > %d\n", bytes, PAGE_SIZE);
+	p = vm_page_alloc(zone->uz_obj, pages, VM_ALLOC_INTERRUPT);
+	if (p == NULL)
+		return (NULL);
+	*flags = UMA_SLAB_PRIV;
+	return ((void *)IA64_PHYS_TO_RR7(VM_PAGE_TO_PHYS(p)));
+}
+
+/* See uma.h */
+int
+uma_zone_set_obj(uma_zone_t zone, struct vm_object *obj, int count)
+{
+	int pages;
 
-	if (bytes <= PAGE_SIZE) {
-		p = vm_page_alloc(zone->uz_obj, pages,
-		    VM_ALLOC_INTERRUPT);
-		if (p == NULL)
-			return (NULL);
-		*flags = UMA_SLAB_PRIV;
-		return ((void *)IA64_PHYS_TO_RR7(VM_PAGE_TO_PHYS(p)));
-	}
+	mtx_lock(&Giant);
+
+	pages = count / zone->uz_ipers;
+
+	if (pages * zone->uz_ipers < count)
+		pages++;
+
+	if (zone->uz_ppera > 1)
+		panic("uma_zone_set_obj: uz_ppera(%d) > 1", zone->uz_ppera);
+
+	if (obj == NULL)
+		obj = vm_object_allocate(OBJT_DEFAULT,
+		    pages);
+	else 
+		_vm_object_allocate(OBJT_DEFAULT,
+		    pages, obj);
 
-	/* 
-	 * This looks a little weird since we're getting one page at a time
-	 */
-	while (bytes > 0) {
-		p = vm_page_alloc(zone->uz_obj, pages,
-		    VM_ALLOC_INTERRUPT);
-		if (p == NULL)
-			return (NULL);
+	ZONE_LOCK(zone);
+	zone->uz_kva = 0;	/* unused */
+	zone->uz_obj = obj;
+	zone->uz_maxpages = pages;
 
-		zkva = zone->uz_kva + pages * PAGE_SIZE;
-		if (retkva == 0)
-			retkva = zkva;
-		pmap_qenter(zkva, &p, 1);
-		bytes -= PAGE_SIZE;
-		pages += 1;
-	}
+	zone->uz_allocf = uma_zone_obj_alloc;
+	zone->uz_flags |= UMA_ZFLAG_NOFREE | UMA_ZFLAG_PRIVALLOC;
 
-	*flags = UMA_SLAB_PRIV;
+	ZONE_UNLOCK(zone);
+	mtx_unlock(&Giant);
 
-	return ((void *)retkva);
+	return (1);
 }

==== //depot/projects/ia64/sys/vm/uma_core.c#25 (text+ko) ====

@@ -81,6 +81,8 @@
 #include <vm/uma_int.h>
 #include <vm/uma_dbg.h>
 
+#include <machine/uma_machdep.h>
+
 /*
  * This is the zone from which all zones are spawned.  The idea is that even 
  * the zone heads are allocated from the allocator, so we use the bss section
@@ -147,9 +149,7 @@
 
 /* Prototypes.. */
 
-#ifdef __ia64__
-void *obj_alloc(uma_zone_t, int, u_int8_t *, int);
-#else
+#ifndef MD_HAVE_OBJ_ALLOC
 static void *obj_alloc(uma_zone_t, int, u_int8_t *, int);
 #endif
 static void *page_alloc(uma_zone_t, int, u_int8_t *, int);
@@ -790,7 +790,7 @@
 	return (p);
 }
 
-#ifndef __ia64__
+#ifndef MD_HAVE_OBJ_ALLOC
 /*
  * Allocates a number of pages from within an object
  *
@@ -1872,6 +1872,7 @@
 	ZONE_UNLOCK(zone);
 }
 
+#ifndef MD_HAVE_UMA_ZONE_SET_OBJ
 /* See uma.h */
 int
 uma_zone_set_obj(uma_zone_t zone, struct vm_object *obj, int count)
@@ -1886,21 +1887,13 @@
 	if (pages * zone->uz_ipers < count)
 		pages++;
 
-#ifdef __ia64__
-if (zone->uz_ppera > 1) {
-#endif
 	kva = kmem_alloc_pageable(kernel_map, pages * UMA_SLAB_SIZE);
 
 	if (kva == 0) {
 		mtx_unlock(&Giant);
 		return (0);
 	}
-#ifdef __ia64__
-} else
-	kva = 0;
-#endif
 
-
 	if (obj == NULL)
 		obj = vm_object_allocate(OBJT_DEFAULT,
 		    pages);
@@ -1921,6 +1914,7 @@
 
 	return (1);
 }
+#endif
 
 /* See uma.h */
 void

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?200210112334.g9BNYhWR049936>