Magazines and Vmem: Extending the Slab Allocator to Many CPUs and Arbitrary Resources
Jeff Bonwick, Jonathan R. Adams · 2001
The slab allocator provides efficient object caching but has two significant limitations: its global locking doesn't scale to many CPUs, and the allocator can't manage resources other than kernel memory. To provide scalability we introduce a per-processor caching scheme called the magazine layer that provides linear scaling to any number of CPUs. To support more general resource allocation we introduce a new virtual memory allocator, vmem, which acts as a universal backing store for the slab allocator. Vmem is a complete general-purpose resource allocator in its own right, providing several important new services; it also appears to be the first resource allocator that can satisfy arbitrary-size allocations in constant time. Magazines and vmem have yielded performance gains exceeding 50% on system-level benchmarks like LADDIS and SPECweb99. We ported these technologies from kernel to user context and found that the resulting libumem outperforms the current best of breed user level memory allocators. libumem also provides a richer programming model and can be used to manage other user level resources.