Deleted Added
full compact
zone.9 (179880) zone.9 (213910)
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.\"
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 $
26.\" $FreeBSD: head/share/man/man9/zone.9 213910 2010-10-16 04:14:45Z lstewart $
27.\"
27.\"
28.Dd June 19, 2008
28.Dd October 9, 2010
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 ,
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
38.Nm uma_zone_set_max,
39.Nm uma_zone_get_max,
40.Nm uma_zone_get_cur
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"
41.Nd zone allocator
42.Sh SYNOPSIS
43.In sys/param.h
44.In sys/queue.h
45.In vm/uma.h
46.Ft uma_zone_t
47.Fo uma_zcreate
48.Fa "char *name" "int size"

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

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

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

171.Fn uma_zdestroy ,
172freeing all memory that was allocated for the zone.
173All items allocated from the zone with
174.Fn uma_zalloc
175must have been freed with
176.Fn uma_zfree
177before.
178.Pp
173The purpose of
179The
174.Fn uma_zone_set_max
180.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.
181function limits the number of items
182.Pq and therefore memory
183that can be allocated to
184.Fa zone .
179The
180.Fa nitems
185The
186.Fa nitems
181argument gives the upper limit of items in the zone.
182This limits the total number of items in the zone which includes:
187argument specifies the requested upper limit number of items.
188The effective limit may end up being higher than requested, as the
189implementation will round up to ensure all memory pages allocated to the zone
190are utilised to capacity.
191The limit applies to 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.
192allocated items, free items and free items in the per-cpu caches.
193On systems with more than one CPU it may not be possible to allocate
194the specified number of items even when there is no shortage of memory,
195because all of the remaining free items may be in the caches of the
196other CPUs when the limit is hit.
197.Pp
198The
199.Fn uma_zone_get_max
200function returns the effective upper limit number of items for a zone.
201.Pp
202The
203.Fn uma_zone_get_cur
204function returns the approximate current occupancy of the zone.
205The returned value is approximate because appropriate synchronisation to
206determine an exact value is not performend by the implementation.
207This ensures low overhead at the expense of potentially stale data being used
208in the calculation.
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 ---
209.Sh RETURN VALUES
210The
211.Fn uma_zalloc
212function returns a pointer to an item, or
213.Dv NULL
214if the zone ran out of unused items and the allocator was unable to
215enlarge it.
216.Sh SEE ALSO

--- 19 unchanged lines hidden ---