patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: "Varghese, Vipin" <vipin.varghese@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Jain, Deepak K" <deepak.k.jain@intel.com>,
	"Mcnamara, John" <john.mcnamara@intel.com>,
	"stable@dpdk.org" <stable@dpdk.org>,
	"Patel, Amol" <amol.patel@intel.com>
Subject: Re: [dpdk-stable] [PATCH] eal/service: add routine to release memory.
Date: Wed, 24 Jan 2018 13:17:29 +0000	[thread overview]
Message-ID: <E923DB57A917B54B9182A2E928D00FA650FF4CAC@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <1516777408-4187-1-git-send-email-vipin.varghese@intel.com>

> From: Varghese, Vipin
> Sent: Wednesday, January 24, 2018 7:03 AM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>; dev@dpdk.org
> Cc: Jain, Deepak K <deepak.k.jain@intel.com>; Mcnamara, John
> <john.mcnamara@intel.com>; stable@dpdk.org; Patel, Amol
> <amol.patel@intel.com>; Varghese, Vipin <vipin.varghese@intel.com>
> Subject: [PATCH] eal/service: add routine to release memory.
> 
> The routine rte_service_finalize cehcks if service is initialized,
> if yes releases the internal meory for services and lcore states.
> 
> This routine is to be invoked at end of application termiantion.
> 
> Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>

Idea looks good to me - two notes below. Check for typos in commit message too :)

For v2, 

Acked-by: Harry van Haaren <harry.van.haaren@intel.com>


<snip>

> diff --git a/lib/librte_eal/common/rte_service.c
> b/lib/librte_eal/common/rte_service.c
> index 5f97d85..5133c98 100644
> --- a/lib/librte_eal/common/rte_service.c
> +++ b/lib/librte_eal/common/rte_service.c
> @@ -108,6 +108,19 @@ int32_t rte_service_init(void)
>  	return 0;
>  }
> 
> +void rte_service_finalize(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;
> +	}
> +}


I find the following implementation cleaner, less if()-ed code?

void rte_service_finalize(void)
{
	if (!rte_service_library_initialized)
		return;

	if (rte_services)
		rte_free(rte_services);
	if (lcore_states)
		rte_free(lcore_states);

	rte_service_library_initialized = 0;
}


> +
> +
>  /* returns 1 if service is registered and has not been unregistered
>   * Returns 0 if service never registered, or has been unregistered
>   */
> diff --git a/lib/librte_eal/rte_eal_version.map
> b/lib/librte_eal/rte_eal_version.map
> index 7088b72..24d1ca7 100644
> --- a/lib/librte_eal/rte_eal_version.map
> +++ b/lib/librte_eal/rte_eal_version.map
> @@ -245,5 +245,6 @@ EXPERIMENTAL {
>  	rte_service_set_runstate_mapped_check;
>  	rte_service_set_stats_enable;
>  	rte_service_start_with_defaults;
> +	rte_service_finalize;
> 
>  } DPDK_18.02;

The version.map file functions should be in alphabetical order;
In this case, add between dump() and get_by_id()

        rte_service_dump;
+       rte_service_finalize;
        rte_service_get_by_id;

      parent reply	other threads:[~2018-01-24 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24  7:03 Vipin Varghese
2018-01-24  8:43 ` [dpdk-stable] [PATCH v2] " Vipin Varghese
2018-01-24 13:17 ` Van Haaren, Harry [this message]

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=E923DB57A917B54B9182A2E928D00FA650FF4CAC@IRSMSX102.ger.corp.intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=amol.patel@intel.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=stable@dpdk.org \
    --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).