From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50058.outbound.protection.outlook.com [40.107.5.58]) by dpdk.org (Postfix) with ESMTP id D1A423256 for ; Tue, 16 Oct 2018 03:25:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QWojzyvgl33hhqPbbY0pmOZF337UIapxfJAV7SBwG+o=; b=qx7T2UoPSU6SYsWQuQFtNNYlCDEmr/vKx1sQULUW0CfptWgaTHGZ2WeAq859gMjmq2pIAyn8f0zpqHeLNqU6WqfFUtQmatofJY9mM/8rhjqp91UPChuQHpvy7NO2ziYtoQzfekAlsNrhD2h78KYVAW1XalYRDFnPatvuXzGXwbU= Received: from AM6PR08MB3672.eurprd08.prod.outlook.com (20.177.115.29) by AM6PR08MB3335.eurprd08.prod.outlook.com (52.135.165.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Tue, 16 Oct 2018 01:25:30 +0000 Received: from AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::f423:e46a:a03c:e928]) by AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::f423:e46a:a03c:e928%3]) with mapi id 15.20.1228.027; Tue, 16 Oct 2018 01:25:30 +0000 From: Honnappa Nagarahalli To: "Wang, Yipeng1" , "Richardson, Bruce" , "De Lara Guarch, Pablo" CC: "dev@dpdk.org" , Dharmik Thakkar , "Gavin Hu (Arm Technology China)" , nd , "Gobriel, Sameh" Thread-Topic: [PATCH v3 2/7] hash: support do not recycle on delete Thread-Index: AQHUYfVapO/XgrIYEEm3bZ4kPO5iEqUcXPFwgAQ9tfA= Date: Tue, 16 Oct 2018 01:25:30 +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: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR08MB3335; 6:z9YRkj4uJzHTlq2Kh8DFS+Sege2FtBOaWQC68ZWINV8H05e4rLepxTsk07SDCF3gXiPuzuxj+9VW2gP4JUW7vjGofdBMXKV1WUEVY/G0VNK/tQo98qoPIFtnbbpVBd0JJz9oDhHN8wqAlPXmFBcSzewZNErhYW4aY2OIfC2mXwVZr8MFZokEeLTqXzuBqjhvl3h8L5g5WtND5o8z0YK7iLLdjEBURMoYTv0n2JOtW4bPWbMqdFe+XQ3Mw7MEA6mJT2HvjNHhjRZfdD/VlJO1saMYmq+wACeFWelpsxGp3hfNMoXWvwubLh6Sfuw+KSo/vtqRlMAZPXvMey88VU6g8D2Z7NgF3e8T0rDWGmq18XwW9BH97/lO42iZZ5vY2Ki57bmg4yFPW3eI85lv6RpaNC2rs3OT85+wZhV6rjuj0AgV2V9SAbUQXgemMgQSBvc9FkenoReEAU5FPjhGqnoe7g==; 5:dqOGGoIe2nlHRGasnYK2vAQ42Xl5nPk3rB/eUK+zmjFpeH4eHN9q5Pa17e+LKteE5Vh2JeFZO8E2wDFZ42uPyMjRFAoKeYLw1ZGrBCfm6rduK391pyzPXU7kyvhu1y6j27DUEHlNC/V0PPHWf9z6ebZ4x0F/cmtBvkh7+noFYYs=; 7:36UOyGfTWvSEPsyHtD18DkA6P+tCqi7Xf/FTnECdMswXpdSlrLUO2e9xdAHykr5j9nlgVFATJFMkLYKPqJQbibUnbSModvOglqKiJo619C3ZQK/DZCUxKS4FpyI2pag1TPic/fWCp3jkcAepIdmmsyGSiWckflsrCgPbNU1Zq5D+g3Or5uGtWvk92KmOOC30WPCZgfhIpBpVQdtI8oa8JQYYWMiafhXcW/C70MitnAD9ylA9Q51EHujw7RpfX7DU x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: a6345a33-0a7b-4636-786d-08d6330642e4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR08MB3335; x-ms-traffictypediagnostic: AM6PR08MB3335: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(278428928389397)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:AM6PR08MB3335; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3335; x-forefront-prvs: 0827D7ACB9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(366004)(396003)(136003)(199004)(189003)(86362001)(74316002)(55016002)(68736007)(53936002)(66066001)(102836004)(9686003)(305945005)(2906002)(110136005)(6506007)(81156014)(7696005)(76176011)(99286004)(54906003)(7736002)(5660300001)(8676002)(81166006)(316002)(6436002)(6116002)(3846002)(71200400001)(229853002)(71190400001)(6246003)(486006)(186003)(8936002)(2900100001)(476003)(14454004)(106356001)(11346002)(14444005)(26005)(33656002)(5250100002)(105586002)(72206003)(256004)(478600001)(25786009)(446003)(97736004)(4326008)(134034003)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB3335; H:AM6PR08MB3672.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: GfTAMuF25t66jomc/81mh03pn51zpiBwzWKk9fHmUOT6Sf66sweW3wZhqT5V7+TkskkiZHkmxgdBXyvE2ieH38UkUwCTDNic+pHHBLq4bcYs1GYWirTPSL3gLhUd6Z1S4eb+phOpuFd0Q8Ixsqvr7AWU4e+es5GjRlZNa6auROl0aYjr5GZtZZhmn/91DIfBVT+8M0Dq7JZ0UR0EuxutE/ua3dv8oWoJXFc9vYBA803SJ5KiwxL+0Dtwjwy01nhTvahD42aOLIT78e6J3ZZTuo9PsbdwF7ZYH4EqqcSrTUFhvxs07PijsOJmi+XFQzMxtZjyI9QqNo9bVm5FkBKD8gcU211e6+FwnSa4ZLGqkMw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6345a33-0a7b-4636-786d-08d6330642e4 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2018 01:25:30.4113 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3335 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: Tue, 16 Oct 2018 01:25:32 -0000 > > > >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? Agree. >=20 > >+/** 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. >=20 > 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 though= t, I > think *free* is more user friendly than recycle. Recycle makes more sense= to > developers. > And you already use *free* for the function name. Will change it to 'NO_FREE_ON_DEL'. It will be disabled by default. Will be= enabled by default for RW-Concurrency-LF. >=20 > > /** > > * 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 > behavior is useful for multi-threading applications which may still have > threads referencing the position after deletion (or other words of which = you > think more clear). I don't think we should address any particular use case here as there can b= e many which we might not have imagined. IMO, it is better to do this in do= cumentation where we can talk about use cases (that we know and want to add= ress) and how to use these APIs. >=20 > Otherwise > Reviewed-by: Yipeng Wang