DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] lib/eal: redefine the name for rte_fbarray_init()
@ 2024-11-14  5:19 Congjie Zhou
  0 siblings, 0 replies; only message in thread
From: Congjie Zhou @ 2024-11-14  5:19 UTC (permalink / raw)
  To: dev; +Cc: anatoly.burakov, Congjie Zhou

add the tsc into the name.

Signed-off-by: Congjie Zhou <zcjie0802@qq.com>
---

When multiple secondary processes run in different containers, names
identified by PIDs are not unique due to the pid namespace.
Add tsc to redefine a unique name.

 lib/eal/linux/eal_memalloc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index e354efc..e683115 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -16,6 +16,7 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <setjmp.h>
+#include <inttypes.h>
 #ifdef F_ADD_SEALS /* if file sealing is supported, so is memfd */
 #include <linux/memfd.h>
 #define MEMFD_SUPPORTED
@@ -1447,8 +1448,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_%"PRIx64,
+		primary_msl->memseg_arr.name, getpid(), rte_rdtsc());
 
 	ret = rte_fbarray_init(&local_msl->memseg_arr, name,
 		primary_msl->memseg_arr.len,
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-11-14  5:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-14  5:19 [PATCH] lib/eal: redefine the name for rte_fbarray_init() Congjie Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).