[PATCH v3] mempool: avoid memzone name collision

Mujahed Mohammed mballas at nvidia.com
Tue Nov 17 20:34:28 CET 2026


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 at dpdk.org

Signed-off-by: Mujahed Mohammed <mballas at 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 at smartsharesystems.com>
 Moti Haimovsky <motih at mellanox.com>
 Muhammad Ahmad <muhammad.ahmad at emumba.com>
 Muhammad Bilal <m.bilal at emumba.com>
+Mujahed Mohammed <mballas at nvidia.com>
 Mukesh Dua <mukesh.dua81 at gmail.com>
 Mukul Katiyar <mukul at versa-networks.com>
 Murphy Yang <murphyx.yang at 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



More information about the dev mailing list