From: Zhou congjie <zcjie0802@qq.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev <dev@dpdk.org>, "anatoly.burakov" <anatoly.burakov@intel.com>
Subject: Re: [PATCH] eal/linux: redefine the name for rte_fbarray_init()
Date: Fri, 15 Nov 2024 10:26:00 +0800 [thread overview]
Message-ID: <tencent_3310EA406E96754A8E98DEEC0CA15CF44006@qq.com> (raw)
In-Reply-To: <20241114090627.65265a75@hermes.local>
On Thu, 14 Nov 2024, Stephen Hemminger wrote:
> Date: Fri, 15 Nov 2024 01:06:27
> From: Stephen Hemminger <stephen@networkplumber.org>
> To: zcjie0802 <zcjie0802@qq.com>
> Cc: dev <dev@dpdk.org>, anatoly.burakov <anatoly.burakov@intel.com>
> Subject: Re: [PATCH] eal/linux: redefine the name for rte_fbarray_init()
>
> 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,
>
As far as know, the tid is pid independent, so programs in different PID
namespaces may have the same pid and tid.
For the solution that uses a global counter, I feel it can only be
implemented by adding variables into rte_config or rte_mem_config, which
involves modifying multiple files. Adding the current time would be more
simple. This code is excuted only once when the secondary process is created, so
it will not cause performance issues.
next prev parent reply other threads:[~2024-11-15 2:26 UTC|newest]
Thread overview: 8+ 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
2024-11-15 2:26 ` Zhou congjie [this message]
2024-11-15 5:32 ` Stephen Hemminger
2024-11-15 1:57 ` Zhou congjie
2024-11-15 2:00 ` Zhou congjie
-- 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=tencent_3310EA406E96754A8E98DEEC0CA15CF44006@qq.com \
--to=zcjie0802@qq.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.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).