Skip to content

Commit 422e7d5

Browse files
Chengming Zhoutehcaster
authored andcommitted
slub: Prepare __slab_free() for unfrozen partial slab out of node partial list
Now the partially empty slub will be frozen when taken out of node partial list, so the __slab_free() will know from "was_frozen" that the partially empty slab is not on node partial list and is a cpu or cpu partial slab of some cpu. But we will change this, make partial slabs leave the node partial list with unfrozen state, so we need to change __slab_free() to use the new slab_test_node_partial() we just introduced. Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
1 parent 8a399e2 commit 422e7d5

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

mm/slub.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3631,6 +3631,7 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab,
36313631
unsigned long counters;
36323632
struct kmem_cache_node *n = NULL;
36333633
unsigned long flags;
3634+
bool on_node_partial;
36343635

36353636
stat(s, FREE_SLOWPATH);
36363637

@@ -3678,6 +3679,7 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab,
36783679
*/
36793680
spin_lock_irqsave(&n->list_lock, flags);
36803681

3682+
on_node_partial = slab_test_node_partial(slab);
36813683
}
36823684
}
36833685

@@ -3706,6 +3708,15 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab,
37063708
return;
37073709
}
37083710

3711+
/*
3712+
* This slab was partially empty but not on the per-node partial list,
3713+
* in which case we shouldn't manipulate its list, just return.
3714+
*/
3715+
if (prior && !on_node_partial) {
3716+
spin_unlock_irqrestore(&n->list_lock, flags);
3717+
return;
3718+
}
3719+
37093720
if (unlikely(!new.inuse && n->nr_partial >= s->min_partial))
37103721
goto slab_empty;
37113722

0 commit comments

Comments
 (0)