paper

The Slab Allocator: An Object-Caching Kernel Memory Allocator

  • Authors:

📜 Abstract

This paper presents a comprehensive design overview of the SunOS 5.4 kernel memory allocator. This allocator is based on a set of object-caching primitives that reduce the cost of allocating complex objects by retaining their state between uses. These same primitives prove equally effective for managing stateless memory (e.g. data pages and temporary buffers) because they are space-efficient and fast. The allocator's object caches respond dynamically to global memory pressure, and employ an object-coloring scheme that improves the system's overall cache utilization and bus balance. The allocator also has several statistical and debugging features that can detect a wide range of problems throughout the system.

✨ Summary

Contribution

The paper presents the SunOS 5.4 kernel memory allocator, centered on object caches that retain initialized objects after deallocation. This avoids repeatedly constructing and destroying frequently used kernel objects and provides fast allocation and release operations. Memory is organized into caches for particular object types, with slabs serving as the principal backing units. The design also applies to stateless memory, including data pages and temporary buffers. (usenix.org)

The allocator addresses both performance and memory efficiency. Slab organization limits search overhead and reduces fragmentation, while cache-specific policies allow the allocator to respond to system-wide memory pressure by reclaiming unused slabs. Object coloring varies object placement within slabs to improve processor-cache utilization and memory-bus balance. Statistical reporting and debugging facilities provide visibility into allocator behavior and help detect memory-management errors. (boki1.github.io)

Influence

The design directly influenced subsequent kernel implementations. The historical Linux mm/slab.c implementation identifies itself as an implementation of Bonwick’s slab allocator and explicitly cites the 1994 paper; it also documents implementation differences from the original design. (kernel.googlesource.com) Slab allocation has also been incorporated into other systems, including the L4 environment, which provides a slab allocator for managing equally sized memory objects. (os.inf.tu-dresden.de)

Bonwick and Jonathan Adams later extended the approach with per-processor magazines and the vmem resource allocator to improve multiprocessor scalability and support allocation of resources beyond kernel memory. That work reported deployment in Solaris 8 and performance improvements exceeding 50 percent on system-level benchmarks, demonstrating the continuing industrial use and extension of the original allocator concepts. (usenix.org)