DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mujahed Mohammed <mballas@nvidia.com>
To: <dev@dpdk.org>
Cc: "Mujahed Mohammed" <mballas@nvidia.com>,
	stable@dpdk.org, "Thomas Monjalon" <thomas@monjalon.net>,
	"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Olivier Matz" <olivier.matz@6wind.com>
Subject: [PATCH v3] mempool: avoid memzone name collision
Date: Tue, 17 Nov 2026 21:34:28 +0200	[thread overview]
Message-ID: <20261117193531.706953-1-mballas@nvidia.com> (raw)
In-Reply-To: <LV3PR12MB914444BAE4DA3B85B4179A4AD47D2@LV3PR12MB9144.namprd12.prod.outlook.com>

Mempool metadata uses MP_<name>, while default-populated backing chunks
use MP_<name>_<id>. If a pool named "foo" spans more than one chunk,
chunk 1 is named MP_foo_1. Creating a pool named "foo_1" then fails to
reserve its MP_foo_1 metadata memzone with EEXIST.

This can be reproduced on a two-NUMA-node system using 2 MiB hugepages
with the following memory setup:

    HugePages_Total: 2048
    HugePages_Free:  2048
    Hugepagesize:    2048 kB

Run testpmd in legacy-memory mode so the first pool spans chunks:

    dpdk-testpmd -n 4 \
        -a 0000:08:00.0 -a 0000:08:00.1 \
        --legacy-mem --socket-mem=0,2048 -- \
        -i --nb-cores=3 --rxq=8 --txq=8 \
        --rxd=2048 --txd=2048 --socket-num=1 --no-numa \
        --mbuf-size=2972,612,512 \
        --rxpkts=2844,612,512 \
        --total-num-mbufs=196608 --enable-scatter

The first pool's chunk 1 and the second pool's metadata both request
MP_mb_pool_1_1.

Use MC_<name>_<id> for chunk memzones, keeping MP_<name> for mempool
metadata. Chunk memzones are not looked up by name, and the new prefix
keeps the existing name-length budget.

Fixes: d1d914ebbc25 ("mempool: allocate in several memory chunks by default")
Cc: stable@dpdk.org

Signed-off-by: Mujahed Mohammed <mballas@nvidia.com>
---
v3:
- Move the fix from testpmd to the mempool library.
- Use the MC_ prefix for backing chunk memzones.
- Add the reproducer and hugepage setup to the commit message.
 .mailmap                  | 1 +
 lib/mempool/rte_mempool.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index a4af517007..fc7750a006 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1183,6 +1183,7 @@ Morten Brørup <mb@smartsharesystems.com>
 Moti Haimovsky <motih@mellanox.com>
 Muhammad Ahmad <muhammad.ahmad@emumba.com>
 Muhammad Bilal <m.bilal@emumba.com>
+Mujahed Mohammed <mballas@nvidia.com>
 Mukesh Dua <mukesh.dua81@gmail.com>
 Mukul Katiyar <mukul@versa-networks.com>
 Murphy Yang <murphyx.yang@intel.com>
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 069aabaa70..8f3c88aeb4 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -565,7 +565,7 @@ rte_mempool_populate_default(struct rte_mempool *mp)
 		}
 
 		ret = snprintf(mz_name, sizeof(mz_name),
-			RTE_MEMPOOL_MZ_FORMAT "_%d", mp->name, mz_id);
+			"MC_%s_%u", mp->name, mz_id);
 		if (ret < 0 || ret >= (int)sizeof(mz_name)) {
 			ret = -ENAMETOOLONG;
 			goto fail;
-- 
2.43.0


      parent reply	other threads:[~2026-11-17 19:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 15:03 [PATCH] app/testpmd: avoid mbuf pool memzone name collision Mujahed Mohammed
2026-11-16 11:25 ` [PATCH v2] " Mujahed Mohammed
2026-11-16 18:44   ` Stephen Hemminger
2026-11-17 19:34 ` Mujahed Mohammed [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=20261117193531.706953-1-mballas@nvidia.com \
    --to=mballas@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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