From: Congjie Zhou <zcjie0802@qq.com>
To: dev@dpdk.org
Cc: anatoly.burakov@intel.com, Congjie Zhou <zcjie0802@qq.com>
Subject: [PATCH] lib/eal: redefine the name for rte_fbarray_init()
Date: Thu, 14 Nov 2024 13:19:22 +0800 [thread overview]
Message-ID: <tencent_0E1DCFC4C9410FE4A052E7B6583BE7C0E80A@qq.com> (raw)
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
reply other threads:[~2024-11-14 5:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=tencent_0E1DCFC4C9410FE4A052E7B6583BE7C0E80A@qq.com \
--to=zcjie0802@qq.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
/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;
as well as URLs for NNTP newsgroup(s).