From: Liam R. Howlett Date: Wed, 11 Dec 2024 03:11:54 +0000 (-0500) Subject: slub: fixups X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6dc776d90ddd42a304d23462eecfee8aca8e853f;p=users%2Fjedix%2Flinux-maple.git slub: fixups Signed-off-by: Liam R. Howlett --- diff --git a/mm/slub.c b/mm/slub.c index 4e72c7794799..f94614ff3086 100644 --- 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; }