diff -r 993aa7c75711 share/man/man9/zone.9 --- a/share/man/man9/zone.9 Sat Oct 09 16:17:26 2010 +1100 +++ b/share/man/man9/zone.9 Sat Oct 09 16:27:06 2010 +1100 @@ -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" @@ -184,9 +184,9 @@ 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 diff -r 993aa7c75711 sys/vm/uma.h --- a/sys/vm/uma.h Sat Oct 09 16:17:26 2010 +1100 +++ b/sys/vm/uma.h Sat Oct 09 16:27:06 2010 +1100 @@ -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 diff -r 993aa7c75711 sys/vm/uma_core.c --- a/sys/vm/uma_core.c Sat Oct 09 16:17:26 2010 +1100 +++ b/sys/vm/uma_core.c Sat Oct 09 16:27:06 2010 +1100 @@ -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 */