From owner-svn-src-all@FreeBSD.ORG Sat May 21 17:43:43 2011 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 6B151106566C; Sat, 21 May 2011 17:43:43 +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 5BE558FC08; Sat, 21 May 2011 17:43:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4LHhh03039505; Sat, 21 May 2011 17:43:43 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4LHhhwe039502; Sat, 21 May 2011 17:43:43 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201105211743.p4LHhhwe039502@svn.freebsd.org> From: Alan Cox Date: Sat, 21 May 2011 17:43:43 +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: r222163 - head/sys/vm 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: Sat, 21 May 2011 17:43:43 -0000 Author: alc Date: Sat May 21 17:43:43 2011 New Revision: 222163 URL: http://svn.freebsd.org/changeset/base/222163 Log: 1. Prior to r214782, UMA did not support multipage allocations before uma_startup2() was called. Thus, setting the variable "booted" to true in uma_startup() was ok on machines with UMA_MD_SMALL_ALLOC defined, because any allocations made after uma_startup() but before uma_startup2() could be satisfied by uma_small_alloc(). Now, however, some multipage allocations are necessary before uma_startup2() just to allocate zone structures on machines with a large number of processors. Thus, a Boolean can no longer effectively describe the state of the UMA allocator. Instead, make "booted" have three values to describe how far initialization has progressed. This allows multipage allocations to continue using startup_alloc() until uma_startup2(), but single-page allocations may begin using uma_small_alloc() after uma_startup(). 2. With the aforementioned change, only a modest increase in boot pages is necessary to boot UMA on a large number of processors. 3. Retire UMA_MD_SMALL_ALLOC_NEEDS_VM. It has only been used between r182028 and r204128. Reviewed by: attilio [1], nwhitehorn [3] Tested by: sbruno Modified: head/sys/vm/uma_core.c head/sys/vm/uma_int.h Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat May 21 16:41:41 2011 (r222162) +++ head/sys/vm/uma_core.c Sat May 21 17:43:43 2011 (r222163) @@ -134,6 +134,8 @@ static struct mtx uma_boot_pages_mtx; /* Is the VM done starting up? */ static int booted = 0; +#define UMA_STARTUP 1 +#define UMA_STARTUP2 2 /* Maximum number of allowed items-per-slab if the slab header is OFFPAGE */ static u_int uma_max_ipers; @@ -959,7 +961,7 @@ startup_alloc(uma_zone_t zone, int bytes return (tmps->us_data); } mtx_unlock(&uma_boot_pages_mtx); - if (booted == 0) + if (booted < UMA_STARTUP2) panic("UMA: Increase vm.boot_pages"); /* * Now that we've booted reset these users to their real allocator. @@ -1317,9 +1319,10 @@ keg_ctor(void *mem, int size, void *udat keg->uk_allocf = uma_small_alloc; keg->uk_freef = uma_small_free; #endif - if (booted == 0) + if (booted < UMA_STARTUP) keg->uk_allocf = startup_alloc; - } else if (booted == 0 && (keg->uk_flags & UMA_ZFLAG_INTERNAL)) + } else if (booted < UMA_STARTUP2 && + (keg->uk_flags & UMA_ZFLAG_INTERNAL)) keg->uk_allocf = startup_alloc; /* @@ -1752,9 +1755,7 @@ uma_startup(void *bootmem, int boot_page bucket_init(); -#if defined(UMA_MD_SMALL_ALLOC) && !defined(UMA_MD_SMALL_ALLOC_NEEDS_VM) - booted = 1; -#endif + booted = UMA_STARTUP; #ifdef UMA_DEBUG printf("UMA startup complete.\n"); @@ -1765,7 +1766,7 @@ uma_startup(void *bootmem, int boot_page void uma_startup2(void) { - booted = 1; + booted = UMA_STARTUP2; bucket_enable(); #ifdef UMA_DEBUG printf("UMA startup2 complete.\n"); Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Sat May 21 16:41:41 2011 (r222162) +++ head/sys/vm/uma_int.h Sat May 21 17:43:43 2011 (r222163) @@ -118,7 +118,7 @@ #define UMA_SLAB_MASK (PAGE_SIZE - 1) /* Mask to get back to the page */ #define UMA_SLAB_SHIFT PAGE_SHIFT /* Number of bits PAGE_MASK */ -#define UMA_BOOT_PAGES 48 /* Pages allocated for startup */ +#define UMA_BOOT_PAGES 64 /* Pages allocated for startup */ /* Max waste before going to off page slab management */ #define UMA_MAX_WASTE (UMA_SLAB_SIZE / 10)