1.\"- 2.\" Copyright (c) 2001 Dag-Erling Co��dan Sm��rgrav 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" |
26.\" $FreeBSD: head/share/man/man9/zone.9 243998 2012-12-07 22:27:13Z pjd $ |
27.\" |
28.Dd December 7, 2012 |
29.Dt ZONE 9 30.Os 31.Sh NAME 32.Nm uma_zcreate , 33.Nm uma_zalloc , 34.Nm uma_zalloc_arg , 35.Nm uma_zfree , 36.Nm uma_zfree_arg , 37.Nm uma_zdestroy , 38.Nm uma_zone_set_max, 39.Nm uma_zone_get_max, |
40.Nm uma_zone_get_cur, 41.Nm uma_zone_set_warning |
42.Nd zone allocator 43.Sh SYNOPSIS 44.In sys/param.h 45.In sys/queue.h 46.In vm/uma.h 47.Ft uma_zone_t 48.Fo uma_zcreate 49.Fa "char *name" "int size" --- 11 unchanged lines hidden (view full) --- 61.Ft void 62.Fn uma_zdestroy "uma_zone_t zone" 63.Ft int 64.Fn uma_zone_set_max "uma_zone_t zone" "int nitems" 65.Ft int 66.Fn uma_zone_get_max "uma_zone_t zone" 67.Ft int 68.Fn uma_zone_get_cur "uma_zone_t zone" |
69.Ft void 70.Fn uma_zone_set_warning "uma_zone_t zone" "const char *warning" |
71.Sh DESCRIPTION 72The zone allocator provides an efficient interface for managing 73dynamically-sized collections of items of similar size. 74The zone allocator can work with preallocated zones as well as with 75runtime-allocated ones, and is therefore available much earlier in the 76boot process than other memory management routines. 77.Pp 78A zone is an extensible collection of items of identical size. --- 132 unchanged lines hidden (view full) --- 211.Pp 212The 213.Fn uma_zone_get_cur 214function returns the approximate current occupancy of the zone. 215The returned value is approximate because appropriate synchronisation to 216determine an exact value is not performed by the implementation. 217This ensures low overhead at the expense of potentially stale data being used 218in the calculation. |
219.Pp 220The 221.Fn uma_zone_set_warning 222function sets a warning that will be printed on the system console when the 223given zone becomes full and fails to allocate an item. 224The warning will be printed not often than every five minutes. 225Warnings can be turned off globally by setting the 226.Va vm.zone_warnings 227sysctl tunable to 228.Va 0 . |
229.Sh RETURN VALUES 230The 231.Fn uma_zalloc 232function returns a pointer to an item, or 233.Dv NULL 234if the zone ran out of unused items 235and 236.Dv M_NOWAIT --- 21 unchanged lines hidden --- |