[v5,04/10] eal_memzone: bail out on initialized
Checks
Commit Message
From: Sinan Kaya <okaya@kernel.org>
Initialize memzone once and bail out if someone calls init
multiple times.
Signed-off-by: Sinan Kaya <okaya@kernel.org>
---
lib/eal/common/eal_common_memzone.c | 6 ++++++
1 file changed, 6 insertions(+)
@@ -425,6 +425,10 @@ rte_eal_memzone_init(void)
{
struct rte_mem_config *mcfg;
int ret = 0;
+ static bool run_once;
+
+ if (run_once)
+ return 0;
/* get pointer to global configuration */
mcfg = rte_eal_get_configuration()->mem_config;
@@ -444,6 +448,8 @@ rte_eal_memzone_init(void)
rte_rwlock_write_unlock(&mcfg->mlock);
+ run_once = true;
+
return ret;
}