Linux 7.2 Slab Changes Include More Performance Optimizations
The slab memory allocation changes for Linux 7.2 have been merged and continue to see more work around shaves and performance optimizations.
Among the interesting slab performance work for Linux 7.2 is this change to defer freelist construction until after bulk allocation from a new slab. Shengming Hu of ZTE noted in that change:
Another interesting for the SLUB allocator is to detach and reattach partial slabs in batch. Hao Li noted a small performance benefit for mmap() from it:
The slab pull request for Linux 7.2 that has since been merged also adds support for allocation tokens as a compiler feature of LLVM Clang 22++ for smarter partitioning of kmalloc caches based on the allocated object type.
Among the interesting slab performance work for Linux 7.2 is this change to defer freelist construction until after bulk allocation from a new slab. Shengming Hu of ZTE noted in that change:
"In slub_bulk_bench, the time per object drops by about 42% to 70% with CONFIG_SLAB_FREELIST_RANDOM=n, and by about 58% to 69% with CONFIG_SLAB_FREELIST_RANDOM=y. This benchmark is intended to isolate the cost removed by this change: each iteration allocates exactly slab->objects from a fresh slab. That makes it a near best-case scenario for deferred freelist construction, because the old path still built a full freelist even when no objects remained, while the new path avoids that work. Realistic workloads may see smaller end-to-end gains depending on how often allocations reach this fresh-slab refill path."
Another interesting for the SLUB allocator is to detach and reattach partial slabs in batch. Hao Li noted a small performance benefit for mmap() from it:
"The will-it-scale mmap benchmark shows a 2% ~ 5% performance improvement after applying this patch."
The slab pull request for Linux 7.2 that has since been merged also adds support for allocation tokens as a compiler feature of LLVM Clang 22++ for smarter partitioning of kmalloc caches based on the allocated object type.
