On 4/10/25 22:24, Suren Baghdasaryan wrote:
> On Mon, Mar 17, 2025 at 7:33 AM Vlastimil Babka <vba...@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.


Reply via email to