]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
slub: fixups
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 11 Dec 2024 03:11:54 +0000 (22:11 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 17 Dec 2024 19:21:30 +0000 (14:21 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/slub.c

index 4e72c779479956944ef1ec6492fabf367de08e9f..f94614ff3086c097ae7819b25995110f4932c3c8 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4938,7 +4938,7 @@ kmem_cache_prefill_sheaf(struct kmem_cache *s, gfp_t gfp, unsigned int count)
 
        pcs = cpu_sheaves_lock(s->cpu_sheaves);
 
-       if (pcs->spare && pcs->spare->size > 0) {
+       if (pcs->spare) {
                sheaf = pcs->spare;
                pcs->spare = NULL;
        }
@@ -4948,8 +4948,9 @@ kmem_cache_prefill_sheaf(struct kmem_cache *s, gfp_t gfp, unsigned int count)
 
        cpu_sheaves_unlock(s->cpu_sheaves);
 
-       if (!sheaf)
+       if (!sheaf) {
                sheaf = alloc_empty_sheaf(s, gfp);
+       }
 
        if (sheaf && sheaf->size < count) {
                if (refill_sheaf(s, sheaf, gfp)) {
@@ -4965,8 +4966,6 @@ kmem_cache_prefill_sheaf(struct kmem_cache *s, gfp_t gfp, unsigned int count)
 int kmem_cache_refill_sheaf(struct kmem_cache *s, gfp_t gfp,
                 struct slab_sheaf *sheaf)
 {
-       struct slub_percpu_sheaves *pcs;
-
        if (!sheaf)
                return -EINVAL;
 
@@ -4998,10 +4997,8 @@ void kmem_cache_return_sheaf(struct kmem_cache *s, gfp_t gfp,
        if (!pcs->spare) {
                pcs->spare = sheaf;
                sheaf = NULL;
-       }
-
-       /* racy check */
-       if (!sheaf && pcs->barn->nr_full >= MAX_FULL_SHEAVES) {
+       } else if (pcs->barn->nr_full >= MAX_FULL_SHEAVES) {
+               /* racy check */
                barn = pcs->barn;
                refill = true;
        }