DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: "Van Haaren, Harry" <harry.van.haaren@intel.com>
Cc: "Varghese, Vipin" <vipin.varghese@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"Jain, Deepak K" <deepak.k.jain@intel.com>
Subject: Re: [dpdk-dev] [PATCH v1] service: fix memory leak by rte_service_init
Date: Mon, 8 Jan 2018 14:40:11 +0000	[thread overview]
Message-ID: <20180108144011.GA4648@bricha3-MOBL3.ger.corp.intel.com> (raw)
In-Reply-To: <E923DB57A917B54B9182A2E928D00FA650FEAB53@IRSMSX102.ger.corp.intel.com>

On Mon, Jan 08, 2018 at 10:17:14AM +0000, Van Haaren, Harry wrote:
> > From: Varghese, Vipin
> > Sent: Sunday, December 31, 2017 2:46 PM
> > To: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>
> > Cc: Jain, Deepak K <deepak.k.jain@intel.com>; Varghese, Vipin
> > <vipin.varghese@intel.com>
> > Subject: [PATCH v1] service: fix memory leak by rte_service_init
> > 
> > This patch fixes the memory leak created by rte_service_init, when
> > run from secondary application. Running secondary application which
> > shares the huge page memory from primary multiple times causes memory
> > to be initialized but not free when application exit.
> > 
> > The rte_service_deinit check if the service is initialized. If yes, it
> > frees up rte_services & lcore_states. The API has to be called at end of
> > application run.
> > 
> > Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> 
> <snip>
> 
> > +++ b/lib/librte_eal/common/rte_service.c
> > @@ -98,6 +98,20 @@ struct core_state {
> >  static struct core_state *lcore_states;
> >  static uint32_t rte_service_library_initialized;
> > 
> > +void rte_service_deinit(void)
> > +{
> > +	if (rte_service_library_initialized) {
> > +		if (rte_services)
> > +			rte_free(rte_services);
> > +		if (lcore_states)
> > +			rte_free(lcore_states);
> > +
> > +		rte_service_library_initialized = 0;
> > +	}
> > +	return;
> > +}
> 
> No return required from void functions
> 
> > +
> > +
> >  int32_t rte_service_init(void)
> >  {
> >  	if (rte_service_library_initialized) {
> > diff --git a/lib/librte_eal/rte_eal_version.map
> > b/lib/librte_eal/rte_eal_version.map
> > index f4f46c1..0f14409 100644
> > --- a/lib/librte_eal/rte_eal_version.map
> > +++ b/lib/librte_eal/rte_eal_version.map
> > @@ -234,5 +234,6 @@ EXPERIMENTAL {
> >  	rte_service_set_runstate_mapped_check;
> >  	rte_service_set_stats_enable;
> >  	rte_service_start_with_defaults;
> > +	rte_service_deinit;
> 
> Alphabetical ordering in the .map files (vim has a nice feature; visual select service functions  then  :sort )
> 
> With above changes;
> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>

Is the opposite of init not "uninit" rather than "deinit"?
Alternatively, "finalize" could be used as the opposite of "initialize",
which would be close to ".init" and ".fini" as used in ELF files.

/Bruce

  reply	other threads:[~2018-01-08 14:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-31 14:46 Vipin Varghese
2018-01-08 10:17 ` Van Haaren, Harry
2018-01-08 14:40   ` Bruce Richardson [this message]
2018-01-11 18:20 ` [dpdk-dev] [PATCH v2] " Vipin Varghese
2018-01-25 22:10   ` Thomas Monjalon
2018-01-26 10:10     ` Van Haaren, Harry
2018-01-26 13:18       ` Thomas Monjalon
2018-01-26 20:55   ` [dpdk-dev] [PATCH v3] " Vipin Varghese
2018-01-26 15:20     ` Van Haaren, Harry
2018-01-26 16:54       ` Thomas Monjalon

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=20180108144011.GA4648@bricha3-MOBL3.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=vipin.varghese@intel.com \
    /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).