From: Stephen Hemminger <stephen@networkplumber.org>
To: Congjie Zhou <zcjie0802@qq.com>
Cc: dev@dpdk.org, anatoly.burakov@intel.com
Subject: Re: [PATCH] eal/linux: redefine the name for rte_fbarray_init()
Date: Thu, 14 Nov 2024 09:06:27 -0800 [thread overview]
Message-ID: <20241114090627.65265a75@hermes.local> (raw)
In-Reply-To: <20241114082459.10a991aa@hermes.local>
What about using thread id instead?
From d1687ffbf865ba0b2d64c35acd602ca43329691e Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@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@intel.com
Reported-by: Congjie Zhou <zcjie0802@qq.com>
Signed-off-by: Stephen Hemminger <stephen@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
next prev parent reply other threads:[~2024-11-14 17:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 8:37 Congjie Zhou
2024-11-14 16:24 ` Stephen Hemminger
2024-11-14 17:06 ` Stephen Hemminger [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-11-14 8:10 Congjie Zhou
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=20241114090627.65265a75@hermes.local \
--to=stephen@networkplumber.org \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=zcjie0802@qq.com \
/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).