[dpdk-dev] [PATCH] Add rte_mempool_free

Simon Kågström simon.kagstrom at netinsight.net
Tue May 17 08:12:47 CEST 2016


Thanks for adding this, I've been missing this function!

On 2016-05-16 21:56, Walker, Benjamin wrote:
> On Mon, 2016-05-16 at 16:57 +0000, Wiles, Keith wrote:

>> The big question is how do you know the mempool is not being used someplace?
> 
> That's the user's responsibility. Use after free is certainly possible if the user doesn't take
> care, just like any alloc/free in C. This is the same situation as rte_ring_free or
> rte_memzone_free. To help prevent users from shooting themselves in the foot I did add a check that
> all of the elements have been freed back to the pool at the top of the function. There are certainly
> potential race conditions if the user is freeing this on one thread and using it from another that I
> haven't handled. I'm not sure these cases need to be handled though - they're not handled by
> rte_ring_free, for example.

Also, the user can use rte_mempool_full() to see if there are entries
still allocated from it.

And perhaps rte_mempool_free() should at least check if the pool is full
before releasing it and warn or panic.

// Simon



More information about the dev mailing list