Slab allocator

From WhitixDoc

Jump to: navigation, search
Source reference
memory/slab.c
slab.c is the slab allocator, which provides for dynamic memory allocation in the kernel.
Memory management series

The slab allocator handles dynamic memory allocation requests by the kernel, through functions such as malloc and MemCacheAlloc. It uses a collection of caches and slabs, data structures that represents allocation of items in a particular page or pages. It is backed by the virtual memory mapping code, and uses functions such as VirtMapPhysRange to map physical memory.

The slab allocator allows other parts of the kernel to create custom-sized caches (to maximise use of memory) and also provides a malloc equivalent, which can allocate anything from 4 bytes to 128KB.

Contents

Data structures

Caches

Slabs

Initialisation

MemCacheAlloc and MemCacheFree

malloc and free caches

Personal tools