News: 0001598171

  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 Fixes A Performance Regression In The Slab Code

([Linux Kernel] 28 Minutes Ago Linux 6.19 + Slab)


A performance fix has been submitted to the Linux kernel for dealing with a regression in the Slab memory allocation code.

The sole patch with today's [1]slab pull request for Linux 6.19 and to be back-ported to Linux 6.18 LTS stable is fixing a performance regression for code involving heavy kmem_cache_destroy() usage.

The kmem_cache_destroy() calls kvfree_rcu_barrier() that ends up flushing RCU sheaves across all slab caches when a cache is destroyed. But that isn't mnecessary with only the RCU sheaves belonging to the cache being destroy should need to be flushed. This stable fix introduces kvfree_rcu_barrier_on_cache() to be more selective about the sheaves being flushed so only the relevant ones are removed.

This new code is now faster and addresses some known performance regressions in the kernel code:

The performance benefit is evaluated on a 12 core 24 threads AMD Ryzen 5900X machine (1 socket), by loading slub_kunit module.

Before:

Total calls: 19

Average latency (us): 18127

Total time (us): 344414

After:

Total calls: 19

Average latency (us): 10066

Total time (us): 191264

Two performance regression have been reported:

- stress module loader test's runtime increases by 50-60% (Daniel)

- internal graphics test's runtime on Tegra23 increases by 35% (Jon)

The performance regression was introduced back in Linux 6.18-rc1 with the introduction of [2]sheaves and persisted through the Linux 6.18 stable release. In the days ahead this patch should be back-ported to a stable Linux 6.18 point release.



[1] https://lore.kernel.org/lkml/80e63358-3016-4208-bfc5-242f201d4f94@suse.cz/

[2] https://www.phoronix.com/news/Linux-6.18-Slab-Sheaves



Q: How many Oregonians does it take to screw in a light bulb?
A: Three. One to screw in the light bulb and two to fend off all those
Californians trying to share the experience.