From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id F25741B3A5 for ; Sat, 13 Oct 2018 03:17:02 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Oct 2018 18:17:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,374,1534834800"; d="scan'208";a="87989006" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 12 Oct 2018 18:17:01 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 12 Oct 2018 18:17:01 -0700 Received: from fmsmsx151.amr.corp.intel.com ([169.254.7.87]) by FMSMSX154.amr.corp.intel.com ([169.254.6.126]) with mapi id 14.03.0319.002; Fri, 12 Oct 2018 18:17:00 -0700 From: "Wang, Yipeng1" To: Honnappa Nagarahalli , "Richardson, Bruce" , "De Lara Guarch, Pablo" CC: "dev@dpdk.org" , "dharmik.thakkar@arm.com" , "gavin.hu@arm.com" , "nd@arm.com" , "Gobriel, Sameh" Thread-Topic: [PATCH v3 2/7] hash: support do not recycle on delete Thread-Index: AQHUYfVapO/XgrIYEEm3bZ4kPO5iEqUcXPFw Date: Sat, 13 Oct 2018 01:17:00 +0000 Message-ID: References: <1539325918-125438-1-git-send-email-honnappa.nagarahalli@arm.com> <1539325918-125438-3-git-send-email-honnappa.nagarahalli@arm.com> In-Reply-To: <1539325918-125438-3-git-send-email-honnappa.nagarahalli@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjM0MDFjZDctYzA5My00MGZmLWFiMDktZWIxNWU0ZTA5OGRmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZHlhdkc1UlZUNVBmMU5JMk5GaU53TTdITmhTRXVONEd5RGZ4SmRvNnlDdHZ1ZFc3cEh2dmM0VXV3eEU4V0lVUiJ9 x-originating-ip: [10.1.200.107] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 2/7] hash: support do not recycle on delete X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Oct 2018 01:17:03 -0000 >-----Original Message----- >From: Honnappa Nagarahalli [mailto:honnappa.nagarahalli@arm.com] >Sent: Thursday, October 11, 2018 11:32 PM >To: Richardson, Bruce ; De Lara Guarch, Pablo = >Cc: dev@dpdk.org; Wang, Yipeng1 ; honnappa.nagarah= alli@arm.com; dharmik.thakkar@arm.com; >gavin.hu@arm.com; nd@arm.com >Subject: [PATCH v3 2/7] hash: support do not recycle on delete > >rte_hash_lookup_xxx APIs return the index of the element in >the key store. Application(reader) can use that index to reference >other data structures in its scope. Because of this, the >index should not be recycled till the application completes >using the index. >RTE_HASH_EXTRA_FLAGS_RECYCLE_ON_DEL is introduced to support this. >When this flag is enabled rte_hash_del_xxx APIs do not free the >key-store index/internal memory associated with the deleted >entry. The new API rte_hash_free_key_with_position should be called >to free the key-store index/internal memory after calling >rte_hash_del_xxx APIs. > > uint8_t ext_table_support; /**< Enable extendable bucket table */ >+ uint8_t recycle_on_del; >+ /**< If internal memory/key-store entry should be >+ * freed on calling the rte_hash_del_xxx APIs. >+ * If this is set, rte_hash_free_key_with_position must be [Wang, Yipeng] If this is *not* set? >+/** Flag to disable freeing of internal memory/indices on hash delete. >+ * Refer to rte_hash_del_xxx APIs for more details. >+ */ >+#define RTE_HASH_EXTRA_FLAGS_RECYCLE_ON_DEL 0x10 >+ [Wang, Yipeng] Maybe call it FREE_AFTER_DEL or NO_FREE_ON_DEL? Recycle_on_= del Sounds like we do the recycle at the delete time, which is opposite to the = meaning. Change *recycle* to *free* to be consistent with the function API name. I guess I suggested to use *recycle* at beginning, but as a second thought, I think *free* is more user friendly than recycle. Recycle makes more sense= to developers. And you already use *free* for the function name. > /** > * The type of hash value of a key. > * It should be a value of at least 32bit with fully random pattern. >@@ -236,6 +243,10 @@ rte_hash_add_key_with_hash(const struct rte_hash *h, = const void *key, hash_sig_t > * and should only be called from one thread by default. > * Thread safety can be enabled by setting flag during > * table creation. >+ * If RTE_HASH_EXTRA_FLAGS_RECYCLE_ON_DEL is enabled, >+ * the hash library's internal memory/index will not be freed by this >+ * API. rte_hash_free_key_with_position API must be called additionally >+ * to free the internal memory/index associated with the key. [Wang, Yipeng] Maybe more explicit on the use case for this flag: This beha= vior is useful for multi-threading applications which may still have threads referencing t= he position after deletion (or other words of which you think more clear). Otherwise Reviewed-by: Yipeng Wang