DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier MATZ <olivier.matz@6wind.com>
To: Peter Chen <peter.feifan.chen@gmail.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] Is rte_mempool library is multi-thread safe ???
Date: Fri, 20 Dec 2013 22:28:02 +0100	[thread overview]
Message-ID: <52B4B662.8050400@6wind.com> (raw)
In-Reply-To: <CAMGYKAfuRdhuydXixJ-ycTQcksRqSKOmFpz8fJGuNZEob04E6Q@mail.gmail.com>

Hi Peter,

On 12/19/2013 10:30 PM, Peter Chen wrote:
> does that mean that on the same core, we can't do rte_eth_rx_burst in one
> thread (I assume this function allocates from mempool for storing mbufs
> everytime it receives a packet), while another thread calls
> rte_pktmbuf_alloc from the same mem_pool?

That's correct. In the rte_mempool code, there is a per-lcore cache:
see the local_cache field of struct rte_mempool.

If you are running several pthreads per lcore, they will share the
same cache if they have the same lcore_id and the mempool is
not designed for that. Therefore it can return wrong results.
The cache can be disabled (at run-time or compile-time), but you will
loose a lot of performance.

Even if you solve the problem of the cache, as the mempool uses a ring
internally, you would still experiment performance issues (see links
from Thomas' previous email).

By the way, why would you need to have several pthreads on one lcore?

Regards,
Olivier

      reply	other threads:[~2013-12-20 21:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19 10:57 ankit kumar
2013-12-19 17:04 ` Thomas Monjalon
2013-12-19 21:30   ` Peter Chen
2013-12-20 21:28     ` Olivier MATZ [this message]

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=52B4B662.8050400@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=peter.feifan.chen@gmail.com \
    /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).