From owner-svn-src-head@FreeBSD.ORG Fri May 2 07:57:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 10BCA84F; Fri, 2 May 2014 07:57:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F14DD16CC; Fri, 2 May 2014 07:57:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s427veIG015752; Fri, 2 May 2014 07:57:40 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s427veV4015749; Fri, 2 May 2014 07:57:40 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201405020757.s427veV4015749@svn.freebsd.org> From: Robert Watson Date: Fri, 2 May 2014 07:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265216 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 May 2014 07:57:41 -0000 Author: rwatson Date: Fri May 2 07:57:40 2014 New Revision: 265216 URL: http://svnweb.freebsd.org/changeset/base/265216 Log: Garbage collect mtxpool_lockbuilder, the mutex pool historically used for lockmgr and sx interlocks, but unused since optimised versions of those sleep locks were introduced. This will save a (quite) small amount of memory in all kernel configurations. The sleep mutex pool is retained as it is used for 'struct bio' and several other consumers. Discussed with: jhb MFC after: 3 days Modified: head/sys/kern/kern_mtxpool.c head/sys/sys/kernel.h head/sys/sys/mutex.h Modified: head/sys/kern/kern_mtxpool.c ============================================================================== --- head/sys/kern/kern_mtxpool.c Fri May 2 07:14:22 2014 (r265215) +++ head/sys/kern/kern_mtxpool.c Fri May 2 07:57:40 2014 (r265216) @@ -59,9 +59,6 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_MTXPOOL, "mtx_pool", "mutex pool"); /* Pool sizes must be a power of two */ -#ifndef MTX_POOL_LOCKBUILDER_SIZE -#define MTX_POOL_LOCKBUILDER_SIZE 128 -#endif #ifndef MTX_POOL_SLEEP_SIZE #define MTX_POOL_SLEEP_SIZE 128 #endif @@ -78,18 +75,12 @@ struct mtx_pool { struct mtx mtx_pool_ary[1]; }; -static struct mtx_pool_lockbuilder { - struct mtxpool_header mtx_pool_header; - struct mtx mtx_pool_ary[MTX_POOL_LOCKBUILDER_SIZE]; -} lockbuilder_pool; - #define mtx_pool_size mtx_pool_header.mtxpool_size #define mtx_pool_mask mtx_pool_header.mtxpool_mask #define mtx_pool_shift mtx_pool_header.mtxpool_shift #define mtx_pool_next mtx_pool_header.mtxpool_next struct mtx_pool *mtxpool_sleep; -struct mtx_pool *mtxpool_lockbuilder; #if UINTPTR_MAX == UINT64_MAX /* 64 bits */ # define POINTER_BITS 64 @@ -166,15 +157,6 @@ mtx_pool_destroy(struct mtx_pool **poolp } static void -mtx_pool_setup_static(void *dummy __unused) -{ - mtx_pool_initialize((struct mtx_pool *)&lockbuilder_pool, - "lockbuilder mtxpool", MTX_POOL_LOCKBUILDER_SIZE, - MTX_DEF | MTX_NOWITNESS | MTX_QUIET); - mtxpool_lockbuilder = (struct mtx_pool *)&lockbuilder_pool; -} - -static void mtx_pool_setup_dynamic(void *dummy __unused) { mtxpool_sleep = mtx_pool_create("sleep mtxpool", @@ -202,17 +184,5 @@ mtx_pool_alloc(struct mtx_pool *pool) return (&pool->mtx_pool_ary[i]); } -/* - * The lockbuilder pool must be initialized early because the lockmgr - * and sx locks depend on it. The sx locks are used in the kernel - * memory allocator. The lockmgr subsystem is initialized by - * SYSINIT(..., SI_SUB_LOCKMGR, ...). - * - * We can't call malloc() to dynamically allocate the sleep pool - * until after kmeminit() has been called, which is done by - * SYSINIT(..., SI_SUB_KMEM, ...). - */ -SYSINIT(mtxpooli1, SI_SUB_MTX_POOL_STATIC, SI_ORDER_FIRST, - mtx_pool_setup_static, NULL); SYSINIT(mtxpooli2, SI_SUB_MTX_POOL_DYNAMIC, SI_ORDER_FIRST, mtx_pool_setup_dynamic, NULL); Modified: head/sys/sys/kernel.h ============================================================================== --- head/sys/sys/kernel.h Fri May 2 07:14:22 2014 (r265215) +++ head/sys/sys/kernel.h Fri May 2 07:57:40 2014 (r265216) @@ -92,7 +92,6 @@ enum sysinit_sub_id { SI_SUB_COPYRIGHT = 0x0800001, /* first use of console*/ SI_SUB_SETTINGS = 0x0880000, /* check and recheck settings */ SI_SUB_MTX_POOL_STATIC = 0x0900000, /* static mutex pool */ - SI_SUB_LOCKMGR = 0x0980000, /* lockmgr locks */ SI_SUB_VM = 0x1000000, /* virtual memory system init*/ SI_SUB_KMEM = 0x1800000, /* kernel memory*/ SI_SUB_KVM_RSRC = 0x1A00000, /* kvm operational limits*/ Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Fri May 2 07:14:22 2014 (r265215) +++ head/sys/sys/mutex.h Fri May 2 07:57:40 2014 (r265216) @@ -323,12 +323,8 @@ struct mtx *mtx_pool_alloc(struct mtx_po mtx_unlock_spin(mtx_pool_find((pool), (ptr))) /* - * mtxpool_lockbuilder is a pool of sleep locks that is not witness - * checked and should only be used for building higher level locks. - * * mtxpool_sleep is a general purpose pool of sleep mutexes. */ -extern struct mtx_pool *mtxpool_lockbuilder; extern struct mtx_pool *mtxpool_sleep; #ifndef LOCK_DEBUG