DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Bruce Richardson" <bruce.richardson@intel.com>
Cc: "Stephen Hemminger" <stephen@networkplumber.org>,
	"Kishore Padmanabha" <kishore.padmanabha@broadcom.com>,
	"fengchengwen" <fengchengwen@huawei.com>,
	"Thomas Monjalon" <thomas@monjalon.net>, "dev" <dev@dpdk.org>,
	"Wisam Jaddo" <wisamm@nvidia.com>,
	"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>
Subject: RE: mempool cache change
Date: Wed, 12 Aug 2026 17:01:42 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F659DA@smartserver.smartshare.dk> (raw)
In-Reply-To: <al8317iuWn7_MpJQ@bricha3-mobl1.ger.corp.intel.com>

> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Tuesday, 21 July 2026 11.12
> 
> On Tue, Jul 21, 2026 at 11:02:34AM +0200, Morten Brørup wrote:
> >    The mempool cache size is configurable.
> >
> >    The application developer should configure it to strike a balance
> >    between the two performance parameters:
> >
> >    - Throughput: Large mempool cache reduces the number of backend
> >    transfers.
> >
> >    - Latency: Large mempool cache causes latency spikes (CPU cache
> misses)
> >    when transferring objects from/to cold backend memory.
> >
> >
> Since 26.11 is an ABI break release, perhaps we can reconsider the
> option
> to have the "keep" value configurable for the mempool caches, i.e. for
> random alloc/free's set it to 50% like you have, or 25% as proposed by
> my
> patch, while for pipeline apps it should be set to 0%. Rather than us
> constantly arguing^H^H^H discussing what the value should be, we can
> make
> it tunable for the developer?
> 
> As an alternative version of that proposal, we can simplify and just
> have a
> couple of predefined simple profiles for 2 or 3 values, one for
> pipeline
> apps, and one or two for run-to-completion, rather than exposing the
> whole
> range of possibilities to the user.

At this time, I'm not planning major changes to the mempool cache algorithm.

I have sent a patch [DIV32] requiring the mempool cache size to be divisible by 32.
This opens a road towards operating on the mempool cache in chunks of 32 objects.

Bruce strongly hinted that the ring driver might not be optimal for mbuf pools,
so I played around with the lock-free stack mempool driver, and it is extremely slow.
To address this issue, I developed a faster stack-like "pile" [PILE-STACK] and a mempool driver [PILE-MEMPOOL] on top of it.

All this playing around and working with the details got me thinking. Which leads back to the subject of 32-object chunks...
The current mempool cache algorithm is targeting large flush/replenish operations.
If the mempool driver is slow (and its runtime scales with the number of objects), large operations will cause latency spikes.

A new algorithm could take a different approach to address latency spikes, targeting small driver operations instead of large driver operations:
When pulling objects from a cache with insufficient objects, only refill the necessary number of objects to satisfy the request, rounded up to 32-object chunks.
When pushing objects from a cache with insufficient space, only flush the necessary number of objects to satisfy the request, rounded up to 32-object chunks.

As a further optimization, instead of moving objects down in the stack when flushing from the bottom, we could use an integer offset to point at the bottom of the stack, and wrap around the index at size when accessing the array. E.g. for push:
for (i = 0; i < num; i++) cache->objs[(cache->bottom + cache->len + i) % size] = obj_table[i];

I don't have plans to implement such an algorithm (or the bottom offset) for DPDK 26.11.
Just sharing my thoughts.

[DIV32]: https://patchwork.dpdk.org/project/dpdk/patch/20260812120626.1772120-1-mb@smartsharesystems.com/
[PILE-STACK]: https://patchwork.dpdk.org/project/dpdk/patch/20260812134756.1829613-1-mb@smartsharesystems.com/
[PILE-MEMPOOL]: https://patchwork.dpdk.org/project/dpdk/patch/20260812141511.1854348-1-mb@smartsharesystems.com/


  reply	other threads:[~2026-08-12 15:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 16:48 mempool cache change Kishore Padmanabha
2026-07-14 20:08 ` Morten Brørup
2026-07-15  8:11   ` fengchengwen
2026-07-15  9:02     ` Morten Brørup
2026-07-15 15:12       ` Kishore Padmanabha
2026-07-16  9:56         ` Bruce Richardson
2026-07-17 17:10           ` Kishore Padmanabha
2026-07-18 14:07             ` Morten Brørup
2026-07-20  8:12               ` Bruce Richardson
2026-07-20 10:54                 ` Morten Brørup
2026-07-21  1:42                   ` Kishore Padmanabha
2026-07-21  6:34                 ` Stephen Hemminger
2026-07-21  9:02                   ` Morten Brørup
2026-07-21  9:11                     ` Bruce Richardson
2026-08-12 15:01                       ` Morten Brørup [this message]
2026-07-21  9:18                   ` Morten Brørup

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=98CBD80474FA8B44BF855DF32C47DC35F659DA@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    --cc=wisamm@nvidia.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