2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

lib/dpdk: No more deferred release

DPDK documentation is recently updated to reflect that DPDK does not
hold any references to, nor take ownership of, the argv/argc elements.
With that understanding, let's just release the memory asap.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
This commit is contained in:
Aaron Conole
2016-12-09 11:22:28 -05:00
committed by Daniele Di Proietto
parent 7967bc775c
commit 71e2a07ad0

View File

@@ -250,11 +250,8 @@ get_dpdk_args(const struct smap *ovs_other_config, char ***argv,
return i + extra_argc;
}
static char **dpdk_argv, **dpdk_argv_release;
static int dpdk_argc;
static void
deferred_argv_release(void)
argv_release(char **dpdk_argv, char **dpdk_argv_release, size_t dpdk_argc)
{
int result;
for (result = 0; result < dpdk_argc; ++result) {
@@ -268,7 +265,7 @@ deferred_argv_release(void)
static void
dpdk_init__(const struct smap *ovs_other_config)
{
char **argv = NULL;
char **argv = NULL, **argv_to_release = NULL;
int result;
int argc, argc_tmp;
bool auto_determine = true;
@@ -367,9 +364,9 @@ dpdk_init__(const struct smap *ovs_other_config)
ds_destroy(&eal_args);
}
dpdk_argv_release = grow_argv(&dpdk_argv_release, 0, argc);
argv_to_release = grow_argv(&argv_to_release, 0, argc);
for (argc_tmp = 0; argc_tmp < argc; ++argc_tmp) {
dpdk_argv_release[argc_tmp] = argv[argc_tmp];
argv_to_release[argc_tmp] = argv[argc_tmp];
}
/* Make sure things are initialized ... */
@@ -377,6 +374,7 @@ dpdk_init__(const struct smap *ovs_other_config)
if (result < 0) {
ovs_abort(result, "Cannot init EAL");
}
argv_release(argv, argv_to_release, argc);
/* Set the main thread affinity back to pre rte_eal_init() value */
if (auto_determine && !err) {
@@ -387,11 +385,6 @@ dpdk_init__(const struct smap *ovs_other_config)
}
}
dpdk_argv = argv;
dpdk_argc = argc;
atexit(deferred_argv_release);
rte_memzone_dump(stdout);
/* We are called from the main thread here */