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 213910 2010-10-16 04:14:45Z lstewart $
27.\"
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 ,
38.Nm uma_zone_set_max,
39.Nm uma_zone_get_max,
40.Nm uma_zone_get_cur
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"
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
179The
180.Fn uma_zone_set_max
181function limits the number of items
182.Pq and therefore memory
183that can be allocated to
184.Fa zone .
185The
186.Fa nitems
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
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.
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 ---
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 213910 2010-10-16 04:14:45Z lstewart $
27.\"
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 ,
38.Nm uma_zone_set_max,
39.Nm uma_zone_get_max,
40.Nm uma_zone_get_cur
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"
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
179The
180.Fn uma_zone_set_max
181function limits the number of items
182.Pq and therefore memory
183that can be allocated to
184.Fa zone .
185The
186.Fa nitems
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
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.
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 ---