[v5,06/10] eal_memory: skip initialization
Checks
Commit Message
From: Sinan Kaya <okaya@kernel.org>
Initialize heap area just once.
Signed-off-by: Sinan Kaya <okaya@kernel.org>
---
lib/eal/common/eal_common_memory.c | 6 ++++++
lib/eal/common/malloc_heap.c | 7 +++++++
2 files changed, 13 insertions(+)
@@ -1083,6 +1083,10 @@ rte_eal_memory_init(void)
const struct internal_config *internal_conf =
eal_get_internal_configuration();
int retval;
+ static bool run_once;
+
+ if (run_once)
+ return 0;
RTE_LOG(DEBUG, EAL, "Setting up physically contiguous memory...\n");
@@ -1101,6 +1105,8 @@ rte_eal_memory_init(void)
if (internal_conf->no_shconf == 0 && rte_eal_memdevice_init() < 0)
goto fail;
+ run_once = true;
+
return 0;
fail:
return -1;
@@ -31,6 +31,7 @@
#define CONST_MAX(a, b) (a > b ? a : b) /* RTE_MAX is not a constant */
#define EXTERNAL_HEAP_MIN_SOCKET_ID (CONST_MAX((1 << 8), RTE_MAX_NUMA_NODES))
+
static unsigned
check_hugepage_sz(unsigned flags, uint64_t hugepage_sz)
{
@@ -1409,6 +1410,10 @@ rte_eal_malloc_heap_init(void)
unsigned int i;
const struct internal_config *internal_conf =
eal_get_internal_configuration();
+ static bool run_once;
+
+ if (run_once)
+ return 0;
if (internal_conf->match_allocations)
RTE_LOG(DEBUG, EAL, "Hugepages will be freed exactly as allocated.\n");
@@ -1435,6 +1440,8 @@ rte_eal_malloc_heap_init(void)
return -1;
}
+ run_once = true;
+
return 0;
}