As seen in the first section of this chapter, Introducing kernel memory allocators, the slab allocator or slab cache is layered above the page allocator (or BSA; refer back to Figure 8.1). The slab allocator justifies its very existence with two primary ideas or purposes:
- Object caching: Here, it serves as a cache of common "objects," and the allocation (and subsequent freeing) of frequently allocated data structures within the Linux kernel, for high performance.
- Mitigate the high wastage (internal fragmentation) of the page allocator by providing small, conveniently sized caches, typically fragments of a page.
Let's now examine these ideas in a more detailed manner.