From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ernst.netinsight.se (ernst.netinsight.se [194.16.221.21]) by dpdk.org (Postfix) with SMTP id 4AF245A95 for ; Tue, 17 May 2016 08:12:54 +0200 (CEST) Received: from [10.100.1.152] (unverified [10.100.1.152]) by ernst.netinsight.se (EMWAC SMTPRS 0.83) with SMTP id ; Tue, 17 May 2016 08:13:10 +0200 To: dev@dpdk.org References: <1463416935-82998-1-git-send-email-benjamin.walker@intel.com> <815F2AB2-EBA1-4097-91B6-14DDD18497BE@intel.com> <1463428590.2522.160.camel@intel.com> From: =?UTF-8?Q?Simon_K=c3=a5gstr=c3=b6m?= Message-ID: <573AB65F.7040801@netinsight.net> Date: Tue, 17 May 2016 08:12:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <1463428590.2522.160.camel@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] Add rte_mempool_free X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2016 06:12:54 -0000 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