[ovs-dev] [RFC PATCH v1] dpdk: Support both shared and per port mempools.

Kevin Traynor ktraynor at redhat.com
Wed May 30 10:51:18 UTC 2018


On 05/30/2018 11:25 AM, Stokes, Ian wrote:
>>> -                     mp_name, mp);
>>> -            /* Ensure this reused mempool will not be freed. */
>>> -            dpdk_mp_do_not_free(mp);
>> The mempool you are about to reuse could have a refcount of 0 and about to
>> be freed by a sweep. So you would need something like the function above
>> before giving up dpdk_mp_mutex. Maybe you could increase the refcount for
>> it now and re-adjust later if you need to.
>>
> So my thinking here was that we run the sweep in netdev_dpdk_mempool_configure() just prior to calling dpdk_mp_create().
> 
> Running the sweep prior should have removed any mempool with refcount 0 in the dpdk_mp_list.

Not necessarily, freeing a 0 refcount dpdk_mp and it's mempool in sweep
is conditional on no in-use mbufs, so it might not have been freed yet.

It won't be freed while you have the lock, but you need to ensure while
you still have the lock that it won't be freed after you release the
lock but before you have updated refcount.

> The list itself is mutex guarded, if there is an existing mempool then the associated refcount would still be 1 I thought but maybe I missed something.
> 
> Do you think it's the case it could be modified between the sweep call and reaching this point?
> 

No, this part is ok, it's just the case above



More information about the dev mailing list