DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Roy Shterman <roy.shterman@gmail.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] Question about cache_size in rte_mempool_create
Date: Fri, 24 Nov 2017 09:30:29 +0000	[thread overview]
Message-ID: <20171124093029.GB11040@bricha3-MOBL3.ger.corp.intel.com> (raw)
In-Reply-To: <CAOBqJ548F0c1609M6BBwPCf1RghhOq89uMDpEyb0ew3ScUA22g@mail.gmail.com>

On Thu, Nov 23, 2017 at 11:05:11PM +0200, Roy Shterman wrote:
> Hi,
> 
> In the documentation it says that:
> 
>  * @param cache_size
>  *   If cache_size is non-zero, the rte_mempool library will try to
>  *   limit the accesses to the common lockless pool, by maintaining a
>  *   per-lcore object cache. This argument must be lower or equal to
>  *   CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE and n / 1.5.* It is advised to
> choose*
> * *   cache_size to have "n modulo cache_size == 0": if this is*
> * *   not the case, some elements will always stay in the pool and will*
> * *   never be used.* The access to the per-lcore table is of course
>  *   faster than the multi-producer/consumer pool. The cache can be
>  *   disabled if the cache_size argument is set to 0; it can be useful to
>  *   avoid losing objects in cache.
> 
> I wonder if someone can please explain the high-lightened sentence, how the
> cache size affects the objects inside the ring.

It has no effects upon the objects themselves. Having a cache is
strongly recommended for performance reasons. Accessing a shared ring
for a mempool is very slow compared to pulling packets from a per-core
cache. To test this you can run testpmd using different --mbcache
parameters. 

> And also does it mean that
> if I'm sharing pool between different cores can it be that a core sees the
> pool as empty although it has objects in it?
> 
Yes, that can occur. You need to dimension the pool to take account of
your cache usage.

/Bruce

  reply	other threads:[~2017-11-24  9:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 21:05 Roy Shterman
2017-11-24  9:30 ` Bruce Richardson [this message]
2017-11-24  9:39   ` roy
2017-11-24 10:03     ` Bruce Richardson
2017-11-24 11:01       ` Roy Shterman
2017-11-24 13:19         ` Bruce Richardson

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=20171124093029.GB11040@bricha3-MOBL3.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=roy.shterman@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).