From owner-svn-src-head@FreeBSD.ORG Sat Oct 16 04:41:46 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B3F91065698; Sat, 16 Oct 2010 04:41:46 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F9DE8FC17; Sat, 16 Oct 2010 04:41:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9G4fkKb014664; Sat, 16 Oct 2010 04:41:46 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9G4fj9K014659; Sat, 16 Oct 2010 04:41:45 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201010160441.o9G4fj9K014659@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 16 Oct 2010 04:41:45 +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: r213911 - in head: share/man/man9 sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 16 Oct 2010 04:41:46 -0000 Author: lstewart Date: Sat Oct 16 04:41:45 2010 New Revision: 213911 URL: http://svn.freebsd.org/changeset/base/213911 Log: Change uma_zone_set_max to return the effective value of "nitems" after rounding. The same value can also be obtained with uma_zone_get_max, but this change avoids a caller having to make two back-to-back calls. Sponsored by: FreeBSD Foundation Reviewed by: gnn, jhb Modified: head/share/man/man9/zone.9 head/sys/vm/uma.h head/sys/vm/uma_core.c Modified: head/share/man/man9/zone.9 ============================================================================== --- head/share/man/man9/zone.9 Sat Oct 16 04:14:45 2010 (r213910) +++ head/share/man/man9/zone.9 Sat Oct 16 04:41:45 2010 (r213911) @@ -59,7 +59,7 @@ .Fn uma_zfree_arg "uma_zone_t zone" "void *item" "void *arg" .Ft void .Fn uma_zdestroy "uma_zone_t zone" -.Ft void +.Ft int .Fn uma_zone_set_max "uma_zone_t zone" "int nitems" .Ft int .Fn uma_zone_get_max "uma_zone_t zone" @@ -185,9 +185,9 @@ that can be allocated to The .Fa nitems argument specifies the requested upper limit number of items. -The effective limit may end up being higher than requested, as the -implementation will round up to ensure all memory pages allocated to the zone -are utilised to capacity. +The effective limit is returned to the caller, as it may end up being higher +than requested due to the implementation rounding up to ensure all memory pages +allocated to the zone are utilised to capacity. The limit applies to the total number of items in the zone, which includes allocated items, free items and free items in the per-cpu caches. On systems with more than one CPU it may not be possible to allocate Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Sat Oct 16 04:14:45 2010 (r213910) +++ head/sys/vm/uma.h Sat Oct 16 04:41:45 2010 (r213911) @@ -452,11 +452,12 @@ int uma_zone_set_obj(uma_zone_t zone, st * * Arguments: * zone The zone to limit + * nitems The requested upper limit on the number of items allowed * * Returns: - * Nothing + * int The effective value of nitems after rounding up based on page size */ -void uma_zone_set_max(uma_zone_t zone, int nitems); +int uma_zone_set_max(uma_zone_t zone, int nitems); /* * Obtains the effective limit on the number of items in a zone Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sat Oct 16 04:14:45 2010 (r213910) +++ head/sys/vm/uma_core.c Sat Oct 16 04:41:45 2010 (r213911) @@ -2782,7 +2782,7 @@ zone_free_item(uma_zone_t zone, void *it } /* See uma.h */ -void +int uma_zone_set_max(uma_zone_t zone, int nitems) { uma_keg_t keg; @@ -2792,8 +2792,10 @@ uma_zone_set_max(uma_zone_t zone, int ni keg->uk_maxpages = (nitems / keg->uk_ipers) * keg->uk_ppera; if (keg->uk_maxpages * keg->uk_ipers < nitems) keg->uk_maxpages += keg->uk_ppera; - + nitems = keg->uk_maxpages * keg->uk_ipers; ZONE_UNLOCK(zone); + + return (nitems); } /* See uma.h */