public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: <dev@dpdk.org>, Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [PATCH] doc: remove obsolete mempool creation advice
Date: Thu, 19 Mar 2026 09:40:48 +0000	[thread overview]
Message-ID: <abvEoELb6QIAHBnW@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20260319091300.652853-1-mb@smartsharesystems.com>

On Thu, Mar 19, 2026 at 09:13:00AM +0000, Morten Brørup wrote:
> The descriptions for the mempool creation functions contained advice for
> choosing the optimum (in terms of memory usage) number of elements and
> cache size.
> The advice was based on implementation details, which was changed long
> ago, making the advice completely irrelevant.
> 

The comment is still correct in most cases, since the default backing
storage remains an rte_ring. If passing a power-of-2 size to mempool create
one will get a backing rte_ring store which is twice as large as requested,
leading to lots of ring slots being wasted. For example, for a pool with
16k elements, the actual ring size allocated will be 32k, leading to
wasting 128k of RAM, and also potentially cache too. The latter will occur
because of the nature of the ring to iterate through all mempool/ring
entries, meaning that even if only 16k of the 32k slots will ever be used,
all 32k slots will be passed through the cpu cache if it works on the
mempool directly and not just from the per-core cache.

On the other hand, I'd be in favour of removing this text if we switched
the default mempool in DPDK to being stack-based. While the stack may not
be lock-free like the ring, with per-lcore caches the number of accesses to
the stack should be small, and it gives much better cache utilization
overall - especially in cases where buffers are allocated on one core and
freed on a different one! Even in cases where we are not transferring
between cores, in a single-core case we still will get better reuse of
"hot" buffers than in an rte_ring-backed case.

/Bruce


  reply	other threads:[~2026-03-19  9:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19  9:13 [PATCH] doc: remove obsolete mempool creation advice Morten Brørup
2026-03-19  9:40 ` Bruce Richardson [this message]
2026-03-19 10:55   ` Morten Brørup
2026-03-19 12:02     ` Bruce Richardson
2026-03-19 12:03 ` Bruce Richardson
2026-03-20  5:44   ` Andrew Rybchenko
2026-03-25 22:39     ` Thomas Monjalon

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=abvEoELb6QIAHBnW@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.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