DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] lib/hash: remove unnecessary locks in lock-free
@ 2019-11-21 18:17 Dharmik Thakkar
  2019-11-25 18:49 ` Wang, Yipeng1
  0 siblings, 1 reply; 9+ messages in thread
From: Dharmik Thakkar @ 2019-11-21 18:17 UTC (permalink / raw)
  To: Yipeng Wang, Sameh Gobriel, Bruce Richardson
  Cc: dev, honnappa.nagarahalli, Dharmik Thakkar

Remove __hash_rw_reader_unlock() calls from lock free hash lookup

Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 lib/librte_hash/rte_cuckoo_hash.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 87a4c01f2f9e..1a4795c82321 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -1285,10 +1285,8 @@ __rte_hash_lookup_with_hash_lf(const struct rte_hash *h, const void *key,
 		/* Check if key is in primary location */
 		bkt = &h->buckets[prim_bucket_idx];
 		ret = search_one_bucket_lf(h, key, short_sig, data, bkt);
-		if (ret != -1) {
-			__hash_rw_reader_unlock(h);
+		if (ret != -1)
 			return ret;
-		}
 		/* Calculate secondary hash */
 		bkt = &h->buckets[sec_bucket_idx];
 
@@ -1296,10 +1294,8 @@ __rte_hash_lookup_with_hash_lf(const struct rte_hash *h, const void *key,
 		FOR_EACH_BUCKET(cur_bkt, bkt) {
 			ret = search_one_bucket_lf(h, key, short_sig,
 						data, cur_bkt);
-			if (ret != -1) {
-				__hash_rw_reader_unlock(h);
+			if (ret != -1)
 				return ret;
-			}
 		}
 
 		/* The loads of sig_current in search_one_bucket
-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-01-19 23:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21 18:17 [dpdk-dev] [PATCH] lib/hash: remove unnecessary locks in lock-free Dharmik Thakkar
2019-11-25 18:49 ` Wang, Yipeng1
2019-11-25 21:54   ` Thomas Monjalon
2019-11-25 22:02     ` Wang, Yipeng1
2019-11-25 22:44       ` Thomas Monjalon
2019-11-25 22:55         ` Dharmik Thakkar
2019-11-25 23:14           ` Thomas Monjalon
2020-01-17 16:42             ` Dharmik Thakkar
2020-01-19 23:37   ` Thomas Monjalon

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).