add the tsc into the name. Suggested-by: Stephen Hemminger <step...@networkplumber.org> Signed-off-by: Congjie Zhou <zcjie0...@qq.com> ---
When multiple secondary processes run in different containers, names identified by PIDs are not unique due to the pid namespace. So Add tsc to redefine a unique name. v1: use monotonic time to redefine the name v2: use tsc to redefine the name v3: include <rte_cycles.h> to support all architectures lib/eal/linux/eal_memalloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c index e354efc..ae1e024 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 @@ -31,6 +32,7 @@ #include <rte_log.h> #include <rte_eal.h> #include <rte_memory.h> +#include <rte_cycles.h> #include "eal_filesystem.h" #include "eal_internal_cfg.h" @@ -1447,8 +1449,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_get_tsc_cycles()); ret = rte_fbarray_init(&local_msl->memseg_arr, name, primary_msl->memseg_arr.len, -- 2.34.1