From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88D3545D08; Fri, 15 Nov 2024 03:26:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75C2242EF2; Fri, 15 Nov 2024 03:26:25 +0100 (CET) Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) by mails.dpdk.org (Postfix) with UTF8SMTP id 026FB42E52 for ; Fri, 15 Nov 2024 03:26:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1731637569; bh=oLxdVJJ1PVRbOoJ5Geo/xAKL/tZJRunTHRLvjd07/rw=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=ULj4p7IxdXYuEYHtCBG70SoOi1icwZKnn7FvMBgH4G9rcUQL74tnn7SLjKGxycjl6 XrQUPOY3Qwokn0SEiCKXF+B54GGzQNbMHEvdsUaogWon2uFyzBPUceG4O6iC6O5mfB 8SLExUt+tgmdXYLmJXYiI2EiWuNnOZ1KcVLHURZI= Received: from LAPTOP-PMPPB61H ([175.167.145.196]) by newxmesmtplogicsvrsza36-0.qq.com (NewEsmtp) with SMTP id 681028AA; Fri, 15 Nov 2024 10:26:01 +0800 X-QQ-mid: xmsmtpt1731637561tpn5xh6v1 Message-ID: X-QQ-XMAILINFO: MI8xiyr9SLuAeCAxDwtpj+IOJiDOaOf2KT+jZMlyq8yayJ9FDaHwzdKJV5Rgft oTPqqeUeRGxmiU8yMCuWOUArsLZKC/0fl9TxMMmPuLavH3PfcU2kmHAhZ+DBxlz90nxwfR8FBokx 3iBWK2kbPTzGLUTPQ/5wTW87lGtkGSCsPQwkJwGamlNs8JfoDmnhcw5qMitbNPr0xuevLFdcN7Hd Yxq410mPfF3SilHN0mTSfgJ22mePTivm9zrWG+4wCWN9RJ/vTshB7t2RPdSaYWp3p6cYQD+D2I/d jTEnimrwIOIgjDwZheqkIlgiJfLxA9dDth50mxMMunf8/37jXf/i9HQ3c9gHZRXGDtJq1GEGsLln gnB9CtS89hwame1T1xKMRsqoldevz5xdNSOMiB/SjVfQCvMCB87RtekLsDQEVGemGjucylz/SW74 wtEZMtKW2NjvN3Zvmjz0abZxNaHBqqHox9sIKE8anzIJLFsgnmIKIlpT2JyMohfJUxWsOzvubpx2 h4hj5NtTkDiEpDSc1IRGEk3yvCHyAtOSJhywkT2TN+Mb5H/oRkgdy1u0LzM001Y6jHmtvfG/qhba X5gY8++i8CyAGLGljWzaNYG0EhpwS1f5UeXJercfaAal1K9zahXnh+MfvGfcdaedi+pWYCwY2Do0 Boi2cHPYn7sjQFxJWBHW8KWv1E7pSxMUW4+7U1EYa0iZ5JR4OSqAsQi4kfOG6fA2k0KmWCW5N96G VEm2OZrrvLZE06nsNgdeIjN2wESVOBOsoTVANO6AyofTj4D4PzDd4U/51OjSGHkKHxAlsWn/yDnz zgfYcwv/bO3D1IoyEpHKG72AAtQyiI/QEuEqJdiaJ1mhXH8pWBsHnTi5tZ7kncF98qqxF4qgJcnk 3C3SkHkI+Hx1dY55QEvsgCfltqZA06GfrTkTy7svbYzDkRj6fZPh5sQCZ+Kfx30jjHm9AyYGVrN0 8WEdOY450yLO/FwVTGTWfEGzK6dYY9 X-QQ-XMRINFO: NyFYKkN4Ny6FSmKK/uo/jdU= Date: Fri, 15 Nov 2024 10:26:00 +0800 From: Zhou congjie To: Stephen Hemminger cc: dev , "anatoly.burakov" Subject: Re: [PATCH] eal/linux: redefine the name for rte_fbarray_init() In-Reply-To: <20241114090627.65265a75@hermes.local> X-OQ-MSGID: <4e846b4c-56e2-3395-e53f-3e4c6ed33493@qq.com> References: <20241114082459.10a991aa@hermes.local> <20241114090627.65265a75@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, 14 Nov 2024, Stephen Hemminger wrote: > Date: Fri, 15 Nov 2024 01:06:27 > From: Stephen Hemminger > To: zcjie0802 > Cc: dev , anatoly.burakov > 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 > 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 > Signed-off-by: Stephen Hemminger > --- > 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.