pcs = cpu_sheaves_lock(s->cpu_sheaves);
- if (pcs->spare && pcs->spare->size > 0) {
+ if (pcs->spare) {
sheaf = pcs->spare;
pcs->spare = NULL;
}
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)) {
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;
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;
}