]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
slab: make __slab_free() more clear
authorVlastimil Babka <vbabka@suse.cz>
Wed, 5 Nov 2025 09:05:29 +0000 (10:05 +0100)
committerVlastimil Babka <vbabka@suse.cz>
Fri, 7 Nov 2025 08:59:15 +0000 (09:59 +0100)
commitf6087b926aea65768975fd4cbc3775965cbd8621
tree19e06ceedc21518c3d8f6779c03f5bee18179d27
parentc379b745e12a99f0a54bafaaf75fc710614511ce
slab: make __slab_free() more clear

The function is tricky and many of its tests are hard to understand. Try
to improve that by using more descriptively named variables and added
comments.

- rename 'prior' to 'old_head' to match the head and tail parameters
- introduce a 'bool was_full' to make it more obvious what we are
  testing instead of the !prior and prior tests
- add or improve comments in various places to explain what we're doing

Also replace kmem_cache_has_cpu_partial() tests with
IS_ENABLED(CONFIG_SLUB_CPU_PARTIAL) which are compile-time constants.
We can do that because the kmem_cache_debug(s) case is handled upfront
via free_to_partial_list().

Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Link: https://patch.msgid.link/20251105-sheaves-cleanups-v1-1-b8218e1ac7ef@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slub.c