start adding .Mt to email addresses in man pages
[dragonfly.git] / share / man / man9 / memory.9
1 .\" $NetBSD: memoryallocators.9,v 1.4 2009/08/03 20:02:55 rmind Exp $
2 .\"
3 .\" Copyright (c) 2011 Venkatesh Srinivas
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" SUCH DAMAGE.
26 .\"
27 .\" $FreeBSD: src/share/man/man9/zone.9,v 1.9.2.4 2002/05/02 20:01:29 asmodai Exp $
28 .\"
29 .Dd March 23, 2011
30 .Dt MEMORY 9
31 .Os
32 .Sh NAME
33 .Nm memory
34 .Nd introduction to kernel memory allocators
35 .Sh DESCRIPTION
36 The
37 .Dx
38 kernel provides several memory allocators, each with different characteristics
39 and purposes.
40 .Ss kmalloc
41 kmalloc is the primary kernel memory allocator. kmalloc allocates pages from
42 the kernel address space via
43 .Xr vm_page_alloc 9
44 and constructs buffers by slicing allocated pages. Allocations larger than 8 KB
45 are served directly with pages from the kernel address space. kmalloc tracks
46 allocation statistics in a malloc_zone structure, which must be declared
47 before use.
48 .Pp
49 kmalloc is implemented as a slab allocator, with per-CPU slab structures. It
50 may block while attempting to get free pages.
51 .Pp
52 For more information, see
53 .Xr kmalloc 9 .
54 .Ss Object caches
55 The object cache is a frontend memory allocator to some backing allocator. It
56 provides for per-CPU caches of constructed objects, saving time on setup of
57 allocated structures. The object cache is well-suited to oft-allocated
58 structures which have relatively complex setup routines.
59 .Pp
60 The object cache routines may block allocating cache structures or buffers.
61 .Pp
62 For more information, see
63 .Xr objcache 9 .
64 .Ss MPIPE
65 MPIPE is a memory allocator frontend to kmalloc; an MPIPE can be created with
66 a fixed number of buffers. The MPIPE guarantees that the desired
67 number of buffers are available and can be allocated without blocking. Beyond
68 the fixed count, MPIPE calls kmalloc and may block or may fail to allocate.
69 .Pp
70 For more information see
71 .Xr mpipe 9 .
72 .Ss The Zone Allocator
73 The zone allocator is a specialized memory allocator; it performs a similar
74 function to kmalloc, but it can run from statically allocated structures in
75 addition to dynamically allocated vm_pages. The zone allocator should be
76 restricted to use before the VM is initialized and to core VM structures.
77 .Pp
78 The zone allocator may block.
79 .Pp
80 For more information see
81 .Xr zone 9 .
82 .Sh HISTORY
83 The kmalloc and Zone allocators were inherited from
84 .Fx .
85 The kmalloc allocator was converted to a per-CPU slab allocator in
86 .Dx 1.0 .
87 .Pp
88 The MPIPE allocator appeared in
89 .Dx 1.0 .
90 The Object cache appeared in
91 .Dx 1.3 .
92 .Sh AUTHORS
93 .An -nosplit
94 This manual page is based on the
95 .Nx
96 analogue, by
97 .An Elad Efrat Aq Mt elad@NetBSD.org
98 and
99 .An YAMAMOTO Takashi Aq Mt yamt@NetBSD.org .