From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99950A04C1; Thu, 21 Nov 2019 19:18:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 99C6C2BA3; Thu, 21 Nov 2019 19:18:16 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id A4C68237 for ; Thu, 21 Nov 2019 19:18:15 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D46F3328; Thu, 21 Nov 2019 10:18:14 -0800 (PST) Received: from 2p2660v4-1.austin.arm.com (2p2660v4-1.austin.arm.com [10.118.12.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CD4273F52E; Thu, 21 Nov 2019 10:18:14 -0800 (PST) From: Dharmik Thakkar To: Yipeng Wang , Sameh Gobriel , Bruce Richardson Cc: dev@dpdk.org, honnappa.nagarahalli@arm.com, Dharmik Thakkar Date: Thu, 21 Nov 2019 12:17:59 -0600 Message-Id: <20191121181759.11401-1-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] lib/hash: remove unnecessary locks in lock-free 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Remove __hash_rw_reader_unlock() calls from lock free hash lookup Signed-off-by: Dharmik Thakkar Reviewed-by: Gavin Hu Reviewed-by: Honnappa Nagarahalli --- 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