From: Vipin Varghese <vipin.varghese@intel.com>
To: harry.van.haaren@intel.com, dev@dpdk.org
Cc: deepak.k.jain@intel.com, john.mcnamara@intel.com,
stable@dpdk.org, amol.patel@intel.com,
Vipin Varghese <vipin.varghese@intel.com>
Subject: [dpdk-stable] [PATCH v2] eal/service: add routine to release memory
Date: Wed, 24 Jan 2018 14:13:21 +0530 [thread overview]
Message-ID: <1516783401-4811-1-git-send-email-vipin.varghese@intel.com> (raw)
In-Reply-To: <1516777408-4187-1-git-send-email-vipin.varghese@intel.com>
The routine rte_service_finalize checks if service is initialized,
if yes; releases internal memory for services and lcore states.
This routine is to be invoked at end of application termination.
Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---
V2 Changes:
- redo the logic for rte_service_finalize
- added in alphabetical order
- cleaned up commit message
---
lib/librte_eal/common/rte_service.c | 16 +++++++++-------
lib/librte_eal/rte_eal_version.map | 2 +-
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index 5133c98..dba74a3 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -110,14 +110,16 @@ int32_t rte_service_init(void)
void rte_service_finalize(void)
{
- if (rte_service_library_initialized) {
- if (rte_services)
- rte_free(rte_services);
- if (lcore_states)
- rte_free(lcore_states);
+ if (!rte_service_library_initialized)
+ return;
- rte_service_library_initialized = 0;
- }
+ if (rte_services)
+ rte_free(rte_services);
+
+ if (lcore_states)
+ rte_free(lcore_states);
+
+ rte_service_library_initialized = 0;
}
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 24d1ca7..1a8b1b5 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -223,6 +223,7 @@ EXPERIMENTAL {
rte_service_component_unregister;
rte_service_component_runstate_set;
rte_service_dump;
+ rte_service_finalize;
rte_service_get_by_id;
rte_service_get_by_name;
rte_service_get_count;
@@ -245,6 +246,5 @@ EXPERIMENTAL {
rte_service_set_runstate_mapped_check;
rte_service_set_stats_enable;
rte_service_start_with_defaults;
- rte_service_finalize;
} DPDK_18.02;
--
1.9.1
next prev parent reply other threads:[~2018-01-24 14:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 7:03 [dpdk-stable] [PATCH] " Vipin Varghese
2018-01-24 8:43 ` Vipin Varghese [this message]
2018-01-24 13:17 ` Van Haaren, Harry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516783401-4811-1-git-send-email-vipin.varghese@intel.com \
--to=vipin.varghese@intel.com \
--cc=amol.patel@intel.com \
--cc=deepak.k.jain@intel.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=john.mcnamara@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).