From: Dharmik Thakkar Date: Thu, 21 Nov 2019 18:17:59 +0000 (-0600) Subject: hash: remove unnecessary locks in lock-free X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cd723fc70cba47ae4688ba48f87ca91a8d04af0a;p=dpdk.git hash: remove unnecessary locks in lock-free Remove __hash_rw_reader_unlock() calls from lock free hash lookup Signed-off-by: Dharmik Thakkar Reviewed-by: Gavin Hu Reviewed-by: Honnappa Nagarahalli Acked-by: Yipeng Wang --- diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c index 6c292b6f80..2ea33ce6ac 100644 --- a/lib/librte_hash/rte_cuckoo_hash.c +++ b/lib/librte_hash/rte_cuckoo_hash.c @@ -1286,10 +1286,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]; @@ -1297,10 +1295,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