[PATCH 1/3] IB/core: add a simple SRQ pool per PD

Max Gurtovoy maxg at mellanox.com
Fri Nov 17 11:17:11 PST 2017



On 11/16/2017 8:32 PM, Sagi Grimberg wrote:
> 
>> +EXPORT_SYMBOL(ib_srq_pool_init);
>> +
>> +void ib_srq_pool_destroy(struct ib_pd *pd)
>> +{
>> +    struct ib_srq *srq;
>> +    unsigned long flags;
>> +
>> +    spin_lock_irqsave(&pd->srq_lock, flags);
>> +    while (!list_empty(&pd->srqs)) {
>> +        srq = list_first_entry(&pd->srqs, struct ib_srq, pd_entry);
>> +        list_del(&srq->pd_entry);
>> +
>> +        spin_unlock_irqrestore(&pd->srq_lock, flags);
>> +        ib_destroy_srq(srq);
>> +        spin_lock_irqsave(&pd->srq_lock, flags);
>> +    }
>> +    spin_unlock_irqrestore(&pd->srq_lock, flags);
> 
> Why not just splicing the list and iterate sanely?

sure, I'll use list_splice_init(&pd->srqs, &tmp_list)



More information about the Linux-nvme mailing list