From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 4BC323772; Wed, 24 Jan 2018 14:17:32 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2018 05:17:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,407,1511856000"; d="scan'208";a="168760225" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga004.jf.intel.com with ESMTP; 24 Jan 2018 05:17:30 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.180]) by IRSMSX101.ger.corp.intel.com ([169.254.1.46]) with mapi id 14.03.0319.002; Wed, 24 Jan 2018 13:17:29 +0000 From: "Van Haaren, Harry" To: "Varghese, Vipin" , "dev@dpdk.org" CC: "Jain, Deepak K" , "Mcnamara, John" , "stable@dpdk.org" , "Patel, Amol" Thread-Topic: [PATCH] eal/service: add routine to release memory. Thread-Index: AQHTlQ+hMMo7M+w6Zka+xJJ6CAj7OKOC/vpQ Date: Wed, 24 Jan 2018 13:17:29 +0000 Message-ID: References: <1516777408-4187-1-git-send-email-vipin.varghese@intel.com> In-Reply-To: <1516777408-4187-1-git-send-email-vipin.varghese@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODAxMDYyN2ItNmNiMi00YzQzLTg4ZTgtMWZhNGQ2MzdlNzA1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ0cEcxM2JKWkhGWEUzZGZxWk5HQlwvNkd1U1Z4Vk9NSStIemNzRDBwWDU1Y050UXoyUjczYnF5ajVQQzFUSFB0SSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [PATCH] eal/service: add routine to release memory. X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2018 13:17:33 -0000 > From: Varghese, Vipin > Sent: Wednesday, January 24, 2018 7:03 AM > To: Van Haaren, Harry ; dev@dpdk.org > Cc: Jain, Deepak K ; Mcnamara, John > ; stable@dpdk.org; Patel, Amol > ; Varghese, Vipin > Subject: [PATCH] eal/service: add routine to release memory. >=20 > The routine rte_service_finalize cehcks if service is initialized, > if yes releases the internal meory for services and lcore states. >=20 > This routine is to be invoked at end of application termiantion. >=20 > Signed-off-by: Vipin Varghese Idea looks good to me - two notes below. Check for typos in commit message = too :) For v2,=20 Acked-by: Harry van Haaren > 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; > } >=20 > +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 =3D 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 =3D 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; >=20 > } 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;