Deleted Added
sdiff udiff text old ( 179880 ) new ( 213910 )
full compact
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 179880 2008-06-19 18:33:38Z remko $
27.\"
28.Dd June 19, 2008
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.Nd zone allocator
40.Sh SYNOPSIS
41.In sys/param.h
42.In sys/queue.h
43.In vm/uma.h
44.Ft uma_zone_t
45.Fo uma_zcreate
46.Fa "char *name" "int size"

--- 7 unchanged lines hidden (view full) ---

54.Ft void
55.Fn uma_zfree "uma_zone_t zone" "void *item"
56.Ft void
57.Fn uma_zfree_arg "uma_zone_t zone" "void *item" "void *arg"
58.Ft void
59.Fn uma_zdestroy "uma_zone_t zone"
60.Ft void
61.Fn uma_zone_set_max "uma_zone_t zone" "int nitems"
62.Sh DESCRIPTION
63The zone allocator provides an efficient interface for managing
64dynamically-sized collections of items of similar size.
65The zone allocator can work with preallocated zones as well as with
66runtime-allocated ones, and is therefore available much earlier in the
67boot process than other memory management routines.
68.Pp
69A zone is an extensible collection of items of identical size.

--- 95 unchanged lines hidden (view full) ---

165.Fn uma_zdestroy ,
166freeing all memory that was allocated for the zone.
167All items allocated from the zone with
168.Fn uma_zalloc
169must have been freed with
170.Fn uma_zfree
171before.
172.Pp
173The purpose of
174.Fn uma_zone_set_max
175is to limit the maximum amount of memory that the system can dedicated
176toward the zone specified by the
177.Fa zone
178argument.
179The
180.Fa nitems
181argument gives the upper limit of items in the zone.
182This limits the total number of items in the zone which includes:
183allocated items, free items and free items in the per-cpu caches.
184On systems with more than one CPU it may not be possible to allocate
185the specified number of items even when there is no shortage of memory,
186because all of the remaining free items may be in the caches of the
187other CPUs when the limit is hit.
188.Sh RETURN VALUES
189The
190.Fn uma_zalloc
191function returns a pointer to an item, or
192.Dv NULL
193if the zone ran out of unused items and the allocator was unable to
194enlarge it.
195.Sh SEE ALSO

--- 19 unchanged lines hidden ---