From owner-svn-src-all@FreeBSD.ORG Sun Jul 5 21:40:22 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 321761065670; Sun, 5 Jul 2009 21:40:22 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F72C8FC15; Sun, 5 Jul 2009 21:40:22 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65LeMbP060447; Sun, 5 Jul 2009 21:40:22 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65LeLoW060444; Sun, 5 Jul 2009 21:40:21 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200907052140.n65LeLoW060444@svn.freebsd.org> From: Alan Cox Date: Sun, 5 Jul 2009 21:40:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195385 - in head/sys/i386: i386 xen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jul 2009 21:40:22 -0000 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