1 .\" $NetBSD: memoryallocators.9,v 1.3 2007/01/09 12:49:36 elad Exp $
3 .\" Copyright (c) 2006 Elad Efrat <elad@NetBSD.org>
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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 .\" 3. The name of the author may not be used to endorse or promote products
15 .\" derived from this software without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 .Dt MEMORYALLOCATORS 9
33 .Nd introduction to kernel memory allocators
37 kernel provides several memory allocators, each with different characteristics
39 This document summarizes the main differences between them.
40 .Ss The Kmem Allocator
41 The kmem allocator is modelled after an interface of similar name implemented in
43 This is main general purpose allocator in the kernel.
45 It is implemented on-top of the
47 resource allocator (beyond the scope of this document), meaning it will be using
49 internally to speed-up common (small) sized allocations.
51 It requires no setup, but cannot be used from interrupt context.
56 .Ss The Pool Allocator
59 allocator is a fixed-size memory allocator.
60 It requires setup (to initialize a memory pool) and is interrupt-safe.
62 .\" On some architectures (foo, bar) the
64 .\" allocator will use direct-mapped segments rather than normal page
65 .\" mappings, which can reduce TLB contentions.
70 .Ss The Pool Cache Allocator
71 The pool cache allocator works on-top of the
73 allocator, also allowing fixed-size allocation only, requires setup,
74 and is interrupt-safe.
76 The pool cache allocator is expected to be faster than other allocators,
81 In the future this allocator is expected to have a per-CPU cache.
86 .Ss The UVM Kernel Memory Allocator
87 This is a low-level memory allocator interface.
88 It allows variable-sized allocations in multiples of
90 and can be used to allocate both wired and pageable kernel memory.
103 .An Elad Efrat Aq elad@NetBSD.org
104 .An YAMAMOTO Takashi Aq yamt@NetBSD.org