]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm, slab: simplify returning slab in __refill_objects_node()
authorVlastimil Babka (SUSE) <vbabka@kernel.org>
Fri, 22 May 2026 14:23:21 +0000 (16:23 +0200)
committerVlastimil Babka (SUSE) <vbabka@kernel.org>
Thu, 28 May 2026 09:51:12 +0000 (11:51 +0200)
When we return slabs to the partial list because we didn't fully refill
from them, we observe the min_partial limit when the returned slab is
empty, and discard it when over the limit. But it's unlikely for the
limit to be reached while we were refilling, and the worst outcome is to
have temporarily more free slabs on the list than necessary. So just
drop that code and simplify the function.

Link: https://patch.msgid.link/20260522-b4-refill-optimistic-return-v3-2-2ba78ec1c6ed@kernel.org
Reviewed-by: Hao Li <hao.li@linux.dev>
Tested-by: Hao Li <hao.li@linux.dev>
Reviewed-by: Harry Yoo (Oracle) <harry@kernel.org>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
mm/slub.c

index 60a765b03b2da103343e4939ca11e06ea21363bf..ff667b22bc040722a7df957e142366b375b9725f 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -7196,21 +7196,11 @@ __refill_objects_node(struct kmem_cache *s, void **p, gfp_t gfp, unsigned int mi
 
                list_for_each_entry_safe(slab, slab2, &pc.slabs, slab_list) {
 
-                       if (unlikely(!slab->inuse && n->nr_partial >= s->min_partial))
-                               continue;
-
                        list_del(&slab->slab_list);
                        add_partial(n, slab, ADD_TO_TAIL);
                }
 
                spin_unlock_irqrestore(&n->list_lock, flags);
-
-               /* any slabs left are completely free and for discard */
-               list_for_each_entry_safe(slab, slab2, &pc.slabs, slab_list) {
-
-                       list_del(&slab->slab_list);
-                       discard_slab(s, slab);
-               }
        }
 
        return refilled;