Linux 7.2 Slab Changes Include More Performance Optimizations
- Reference: 0001641484
- News link: https://www.phoronix.com/news/Linux-7.2-Slab
- Source link:
Among the interesting slab performance work for Linux 7.2 is [2]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 change 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 [3]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.
[1] https://www.phoronix.com/search/sheaves
[2] https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git/commit/?h=slab/for-7.2/perf&id=dc795d4c0282a4fbfbcd76a70c09ca0888678443
[3] https://lore.kernel.org/lkml/fa60be45-ffdd-43f6-b1c0-4a8ed1d5c4cc@kernel.org/