[PATCH v1 4/7] memseg: init once
okaya at kernel.org
okaya at kernel.org
Tue Aug 15 03:38:23 CEST 2023
From: Sinan Kaya <okaya at kernel.org>
Initialize memory segments just once and bail out if called
multiple times.
Signed-off-by: Sinan Kaya <okaya at kernel.org>
---
lib/eal/linux/eal_memory.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 60fc8cc6ca..c7bf879d15 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -1902,6 +1902,11 @@ rte_eal_memseg_init(void)
{
/* increase rlimit to maximum */
struct rlimit lim;
+ static bool memseg_initialized = 0;
+ int ret;
+
+ if (memseg_initialized)
+ return 0;
#ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES
const struct internal_config *internal_conf =
@@ -1930,11 +1935,15 @@ rte_eal_memseg_init(void)
}
#endif
- return rte_eal_process_type() == RTE_PROC_PRIMARY ?
+ ret = rte_eal_process_type() == RTE_PROC_PRIMARY ?
#ifndef RTE_ARCH_64
memseg_primary_init_32() :
#else
memseg_primary_init() :
#endif
memseg_secondary_init();
+
+ memseg_initialized = true;
+
+ return ret;
}
--
2.25.1
More information about the dev
mailing list