Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jul 2009 21:40:21 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r195385 - in head/sys/i386: i386 xen
Message-ID:  <200907052140.n65LeLoW060444@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sun Jul  5 21:40:21 2009
New Revision: 195385
URL: http://svn.freebsd.org/changeset/base/195385

Log:
  PAE adds another level to the i386 page table.  This level is a small
  4-entry table that must be located within the first 4GB of RAM.  This
  requirement is met by defining an UMA zone with a custom back-end
  allocator function.  This revision makes two changes to this back-end
  allocator function: (1) It replaces the use of contigmalloc() with the
  use of kmem_alloc_contig().  This eliminates "double accounting", i.e.,
  accounting by both the UMA zone and malloc tags.  (I made the same
  change for the same reason to the zones supporting jumbo frames a week
  ago.) (2) It passes through the "wait" parameter, i.e., M_WAITOK,
  M_ZERO, etc. to kmem_alloc_contig() rather than ignoring it.
  pmap_init() calls uma_zalloc() with both M_WAITOK and M_ZERO.  At the
  moment, this is harmless only because the default behavior of
  contigmalloc()/kmem_alloc_contig() is to wait and because pmap_init()
  doesn't really depend on the memory being zeroed.
  
  The back-end allocator function in the Xen pmap is dead code.  I am
  changing it nonetheless because I don't want to leave any "bad examples"
  in the source tree for someone to copy at a later date.
  
  Approved by:	re (kib)

Modified:
  head/sys/i386/i386/pmap.c
  head/sys/i386/xen/pmap.c

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Sun Jul  5 21:35:05 2009	(r195384)
+++ head/sys/i386/i386/pmap.c	Sun Jul  5 21:40:21 2009	(r195385)
@@ -562,17 +562,14 @@ pmap_page_init(vm_page_t m)
 }
 
 #ifdef PAE
-
-static MALLOC_DEFINE(M_PMAPPDPT, "pmap", "pmap pdpt");
-
 static void *
 pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
 {
 
 	/* Inform UMA that this allocator uses kernel_map/object. */
 	*flags = UMA_SLAB_KERNEL;
-	return (contigmalloc(PAGE_SIZE, M_PMAPPDPT, 0, 0x0ULL, 0xffffffffULL,
-	    1, 0));
+	return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, 0x0ULL,
+	    0xffffffffULL, 1, 0, VM_CACHE_DEFAULT));
 }
 #endif
 

Modified: head/sys/i386/xen/pmap.c
==============================================================================
--- head/sys/i386/xen/pmap.c	Sun Jul  5 21:35:05 2009	(r195384)
+++ head/sys/i386/xen/pmap.c	Sun Jul  5 21:40:21 2009	(r195385)
@@ -608,15 +608,14 @@ pmap_page_init(vm_page_t m)
 }
 
 #if defined(PAE) && !defined(XEN)
-
-static MALLOC_DEFINE(M_PMAPPDPT, "pmap", "pmap pdpt");
-
 static void *
 pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
 {
-	*flags = UMA_SLAB_PRIV;
-	return (contigmalloc(PAGE_SIZE, M_PMAPPDPT, 0, 0x0ULL, 0xffffffffULL,
-	    1, 0));
+
+	/* Inform UMA that this allocator uses kernel_map/object. */
+	*flags = UMA_SLAB_KERNEL;
+	return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, 0x0ULL,
+	    0xffffffffULL, 1, 0, VM_CACHE_DEFAULT));
 }
 #endif
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907052140.n65LeLoW060444>