DragonFly On-Line Manual Pages

Search: Section:  

MEMORY(9)	      DragonFly Kernel Developer's Manual	     MEMORY(9)


memory -- introduction to kernel memory allocators


The DragonFly kernel provides several memory allocators, each with dif- ferent characteristics and purposes. kmalloc kmalloc is the primary kernel memory allocator. kmalloc allocates pages from the kernel address space via vm_page_alloc(9) and constructs buffers by slicing allocated pages. Allocations larger than 8 KB are served directly with pages from the kernel address space. kmalloc tracks alloca- tion statistics in a malloc_zone structure, which must be declared before use. kmalloc is implemented as a slab allocator, with per-CPU slab structures. It may block while attempting to get free pages. For more information, see kmalloc(9). Object caches The object cache is a frontend memory allocator to some backing alloca- tor. It provides for per-CPU caches of constructed objects, saving time on setup of allocated structures. The object cache is well-suited to oft- allocated structures which have relatively complex setup routines. The object cache routines may block allocating cache structures or buf- fers. For more information, see objcache(9). MPIPE MPIPE is a memory allocator frontend to kmalloc; an MPIPE can be created with a fixed number of buffers. The MPIPE guarantees that the desired number of buffers are available and can be allocated without blocking. Beyond the fixed count, MPIPE calls kmalloc and may block or may fail to allocate. For more information see mpipe(9). The Zone Allocator The zone allocator is a specialized memory allocator; it performs a simi- lar function to kmalloc, but it can run from statically allocated struc- tures in addition to dynamically allocated vm_pages. The zone allocator should be restricted to use before the VM is initialized and to core VM structures. The zone allocator may block. For more information see zone(9).


The kmalloc and Zone allocators were inherited from FreeBSD. The kmalloc allocator was converted to a per-CPU slab allocator in DragonFly 1.0. The MPIPE allocator appeared in DragonFly 1.0. The Object cache appeared in DragonFly 1.3.


This manual page is based on the NetBSD analogue, by Elad Efrat <elad@NetBSD.org> and YAMAMOTO Takashi <yamt@NetBSD.org>. DragonFly 4.7 March 23, 2011 DragonFly 4.7

Search: Section: