DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Simon Kågström" <simon.kagstrom@netinsight.net>
To: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] Add rte_mempool_free
Date: Tue, 17 May 2016 08:12:47 +0200	[thread overview]
Message-ID: <573AB65F.7040801@netinsight.net> (raw)
In-Reply-To: <1463428590.2522.160.camel@intel.com>

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

  reply	other threads:[~2016-05-17  6:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16 16:42 Ben Walker
2016-05-16 16:57 ` Wiles, Keith
2016-05-16 19:56   ` Walker, Benjamin
2016-05-17  6:12     ` Simon Kågström [this message]
2016-05-17  7:32     ` Olivier MATZ

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=573AB65F.7040801@netinsight.net \
    --to=simon.kagstrom@netinsight.net \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).