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: [email protected]
Signed-off-by: Mujahed Mohammed <[email protected]>
---
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 <[email protected]>
Moti Haimovsky <[email protected]>
Muhammad Ahmad <[email protected]>
Muhammad Bilal <[email protected]>
+Mujahed Mohammed <[email protected]>
Mukesh Dua <[email protected]>
Mukul Katiyar <[email protected]>
Murphy Yang <[email protected]>
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