From owner-svn-src-all@FreeBSD.ORG Thu Jun 18 17:59:05 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 4CB561065672; Thu, 18 Jun 2009 17:59:05 +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 3B71F8FC16; Thu, 18 Jun 2009 17:59:05 +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 n5IHx5K6018753; Thu, 18 Jun 2009 17:59:05 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5IHx5EL018751; Thu, 18 Jun 2009 17:59:05 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200906181759.n5IHx5EL018751@svn.freebsd.org> From: Alan Cox Date: Thu, 18 Jun 2009 17:59:05 +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: r194454 - head/sys/kern 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: Thu, 18 Jun 2009 17:59:05 -0000 Author: alc Date: Thu Jun 18 17:59:04 2009 New Revision: 194454 URL: http://svn.freebsd.org/changeset/base/194454 Log: Utilize the new function kmem_alloc_contig() to implement the UMA back-end allocator for the jumbo frames zones. This change has two benefits: (1) a custom back-end deallocator is no longer required. UMA's standard deallocator suffices. (2) It eliminates a potentially confusing artifact of using contigmalloc(): The malloc(9) statistics contain bogus information about the usage of jumbo frames. Specifically, the malloc(9) statistics report all jumbo frames in use whereas the UMA zone statistics report the "truth" about the number in use vs. the number free. Modified: head/sys/kern/kern_mbuf.c Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Thu Jun 18 17:44:42 2009 (r194453) +++ head/sys/kern/kern_mbuf.c Thu Jun 18 17:59:04 2009 (r194454) @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -232,9 +234,6 @@ static void mb_zfini_pack(void *, int); static void mb_reclaim(void *); static void mbuf_init(void *); static void *mbuf_jumbo_alloc(uma_zone_t, int, u_int8_t *, int); -static void mbuf_jumbo_free(void *, int, u_int8_t); - -static MALLOC_DEFINE(M_JUMBOFRAME, "jumboframes", "mbuf jumbo frame buffers"); /* Ensure that MSIZE doesn't break dtom() - it must be a power of 2 */ CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE); @@ -296,7 +295,6 @@ mbuf_init(void *dummy) if (nmbjumbo9 > 0) uma_zone_set_max(zone_jumbo9, nmbjumbo9); uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc); - uma_zone_set_freef(zone_jumbo9, mbuf_jumbo_free); zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES, mb_ctor_clust, mb_dtor_clust, @@ -309,7 +307,6 @@ mbuf_init(void *dummy) if (nmbjumbo16 > 0) uma_zone_set_max(zone_jumbo16, nmbjumbo16); uma_zone_set_allocf(zone_jumbo16, mbuf_jumbo_alloc); - uma_zone_set_freef(zone_jumbo16, mbuf_jumbo_free); zone_ext_refcnt = uma_zcreate(MBUF_EXTREFCNT_MEM_NAME, sizeof(u_int), NULL, NULL, @@ -358,18 +355,8 @@ mbuf_jumbo_alloc(uma_zone_t zone, int by /* Inform UMA that this allocator uses kernel_map/object. */ *flags = UMA_SLAB_KERNEL; - return (contigmalloc(bytes, M_JUMBOFRAME, wait, (vm_paddr_t)0, - ~(vm_paddr_t)0, 1, 0)); -} - -/* - * UMA backend page deallocator for the jumbo frame zones. - */ -static void -mbuf_jumbo_free(void *mem, int size, u_int8_t flags) -{ - - contigfree(mem, size, M_JUMBOFRAME); + return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, + (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0)); } /*