]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
slub: Reverse barn_get_full_or_empty_sheaf() ordering
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 12 Dec 2024 14:13:12 +0000 (09:13 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 17 Dec 2024 19:21:30 +0000 (14:21 -0500)
Get full sheaves before returning empty ones

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/slub.c

index f94614ff3086c097ae7819b25995110f4932c3c8..89480ba75fefc4328ed27793d93b795d196352a4 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2827,16 +2827,16 @@ static struct slab_sheaf *barn_get_full_or_empty_sheaf(struct node_barn *barn)
 
        spin_lock_irqsave(&barn->lock, flags);
 
-       if (barn->nr_empty) {
-               sheaf = list_first_entry(&barn->sheaves_empty,
-                                        struct slab_sheaf, barn_list);
-               list_del(&sheaf->barn_list);
-               barn->nr_empty--;
-       } else if (barn->nr_full) {
+       if (barn->nr_full) {
                sheaf = list_first_entry(&barn->sheaves_full, struct slab_sheaf,
                                        barn_list);
                list_del(&sheaf->barn_list);
                barn->nr_full--;
+       } else if (barn->nr_empty) {
+               sheaf = list_first_entry(&barn->sheaves_empty,
+                                        struct slab_sheaf, barn_list);
+               list_del(&sheaf->barn_list);
+               barn->nr_empty--;
        }
 
        spin_unlock_irqrestore(&barn->lock, flags);