[PATCH RFC v3 3/8] slab: add sheaf support for batching kfree_rcu() operations
Vlastimil Babka
vbabka at suse.cz
Tue Apr 22 08:18:32 PDT 2025
On 4/10/25 22:24, Suren Baghdasaryan wrote:
> On Mon, Mar 17, 2025 at 7:33 AM Vlastimil Babka <vbabka at suse.cz> wrote:
>> +do_free:
>> +
>> + rcu_sheaf = pcs->rcu_free;
>> +
>> + rcu_sheaf->objects[rcu_sheaf->size++] = obj;
>> +
>> + if (likely(rcu_sheaf->size < s->sheaf_capacity)) {
>> + localtry_unlock(&s->cpu_sheaves->lock);
>> + stat(s, FREE_RCU_SHEAF);
>> + return true;
>> + }
>> +
>> + pcs->rcu_free = NULL;
>> + localtry_unlock(&s->cpu_sheaves->lock);
>> +
>> + call_rcu(&rcu_sheaf->rcu_head, rcu_free_sheaf);
>> +
>> + stat(s, FREE_RCU_SHEAF);
>> + return true;
>
> nit: I think the above code could be simplified to:
>
> do_free:
> rcu_sheaf = pcs->rcu_free;
> rcu_sheaf->objects[rcu_sheaf->size++] = obj;
> if (likely(rcu_sheaf->size < s->sheaf_capacity))
> rcu_sheaf = NULL;
> else
> pcs->rcu_free = NULL;
>
> localtry_unlock(&s->cpu_sheaves->lock);
> stat(s, FREE_RCU_SHEAF);
> if (rcu_sheaf)
> call_rcu(&rcu_sheaf->rcu_head, rcu_free_sheaf);
>
> return true;
Right, done. Thanks.
More information about the maple-tree
mailing list