[PATCH] eal/linux: redefine the name for rte_fbarray_init()

Stephen Hemminger stephen at networkplumber.org
Thu Nov 14 18:06:27 CET 2024


What about using thread id instead?

From d1687ffbf865ba0b2d64c35acd602ca43329691e Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Thu, 14 Nov 2024 08:48:54 -0800
Subject: [PATCH] eal: fix fbarray name with multiple secondary processes

When multiple secondary processes run in different containers, names
identified by PIDs are not unique due to the pid namespace.
Add current thread id to the name to be unique.

Fixes: 046aa5c4477b ("mem: add memalloc init stage")
Cc: anatoly.burakov at intel.com

Reported-by: Congjie Zhou <zcjie0802 at qq.com>
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/eal/linux/eal_memalloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index e354efc95d..776260e14f 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -1447,8 +1447,8 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
 	local_msl = &local_memsegs[msl_idx];
 
 	/* create distinct fbarrays for each secondary */
-	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
-		primary_msl->memseg_arr.name, getpid());
+	snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i_%i",
+		 primary_msl->memseg_arr.name, getpid(), rte_sys_gettid());
 
 	ret = rte_fbarray_init(&local_msl->memseg_arr, name,
 		primary_msl->memseg_arr.len,
-- 
2.45.2




More information about the dev mailing list