Merged for Linux 6.18 was a new feature called Sheaves as an opt-in, per-CPU array-based caching layer. Plus there is a per-NUMA-node cache of Sheaves called a “Barn”. In continuing to build out the Linux kernel usage of Sheaves, a set of initial patches were posted this week to replace the CPU slabs with Sheaves within the slub allocator code.
Vlastimil Babka of SUSE explained within the new patch series entitled slab: replace cpu (partial) slabs with sheaves:
“Percpu sheaves caching was introduced as opt-in but the goal was to eventually move all caches to them. This is the next step, enabling sheaves for all caches (except the two bootstrap ones) and then removing the per cpu (partial) slabs and lots of associated code.
Besides (hopefully) improved performance, this removes the rather complicated code related to the lockless fastpaths (using this_cpu_try_cmpxchg128/64) and its complications with PREEMPT_RT or kmalloc_nolock().
The lockless slab freelist+counters update operation using try_cmpxchg128/64 remains and is crucial for freeing remote NUMA objects without repeating the “alien” array flushing of SLUB, and to allow flushing objects from sheaves to slabs mostly without the node
list_lock.This is the first RFC to get feedback. Biggest TODOs are:
– cleanup of stat counters to fit the new scheme
– integration of rcu sheaves handling with kfree_rcu batching
– performance evaluation”
Unfortunately for this initial Request For Comments (RFC) patch series is no insight into the performance besides it “hopefully” delivering better performance with a proper performance evaluation yet to be completed. Hopefully that is soon for being able to help quantify the Sheaves performance story for Linux. I’ll also be running fresh Linux kernel benchmarks as time allows. In any event at least this work allows simplifying some complicated allocator code within the kernel.
This turning to Sheaves to replace the CPU (partial) slabs usage from the slab/slub allocator code paths ends up to dropping just over 900 lines of code while introducing 1.7k new lines.
