News: 0001641484

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Linux 7.2 Slab Changes Include More Performance Optimizations

([Linux Kernel] 120 Minutes Ago Slab Allocator)


The slab memory allocation changes for Linux 7.2 have been merged and continue to see more work around [1]shaves and performance optimizations.

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/



This product is meant for educational purposes only. Any resemblance to real
persons, living or dead is purely coincidental. Void where prohibited. Some
assembly may be required. Batteries not included. Contents may settle during
shipment. Use only as directed. May be too intense for some viewers. If
condition persists, consult your physician. No user-serviceable parts inside.
Breaking seal constitutes acceptance of agreement. Not responsible for direct,
indirect, incidental or consequential damages resulting from any defect, error
or failure to perform. Slippery when wet. For office use only. Substantial
penalty for early withdrawal. Do not write below this line. Your cancelled
check is your receipt. Avoid contact with skin. Employees and their families
are not eligible. Beware of dog. Driver does not carry cash. Limited time
offer, call now to insure prompt delivery. Use only in well-ventilated area.
Keep away from fire or flame. Some equipment shown is optional. Price does
not include taxes, dealer prep, or delivery. Penalty for private use. Call
toll free before digging. Some of the trademarks mentioned in this product
appear for identification purposes only. All models over 18 years of age. Do
not use while operating a motor vehicle or heavy equipment. Postage will be
paid by addressee. Apply only to affected area. One size fits all. Many
suitcases look alike. Edited for television. No solicitors. Reproduction
strictly prohibited. Restaurant package, not for resale. Objects in mirror
are closer than they appear. Decision of judges is final. This supersedes
all previous notices. No other warranty expressed or implied.