Skip to contentSkip to conversation

lib/hash: remove unnecessary locks in lock-free

PATCH Applied Dharmik Thakkar 3 participants 9 messages Nov 21, 2019 – Jan 19, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/hash: remove unnecessary locks in lock-free

Remove __hash_rw_reader_unlock() calls from lock free hash lookup

---
 lib/librte_hash/rte_cuckoo_hash.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
lib/librte_hash/rte_cuckoo_hash.c +2 -6
index 87a4c01f2f9e..1a4795c82321 100644
@@ -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
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines

-----Original Message-----
From: Dharmik Thakkar [mailto:[email protected]]
Sent: Thursday, November 21, 2019 10:18 AM
To: Wang, Yipeng1 <[email protected]>; Gobriel, Sameh <[email protected]>; Richardson, Bruce <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [PATCH] lib/hash: remove unnecessary locks in lock-free

Quoted 6 lines

Remove __hash_rw_reader_unlock() calls from lock free hash lookup

---

Thanks for the patch!

#2 lore raw

25/11/2019 19:49, Wang, Yipeng1:

Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: Dharmik Thakkar [mailto:[email protected]]
Sent: Thursday, November 21, 2019 10:18 AM
To: Wang, Yipeng1 <[email protected]>; Gobriel, Sameh <[email protected]>; Richardson, Bruce <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [PATCH] lib/hash: remove unnecessary locks in lock-free

Remove __hash_rw_reader_unlock() calls from lock free hash lookup

Quoted 7 lines
Quoted 4 lines

---

Thanks for the patch!

Excuse me, there is no motivation (the why) in this patch. Is it critical? which gain?

#3 lore raw
Quoted 23 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, November 25, 2019 1:55 PM
To: Wang, Yipeng1 <[email protected]>; Dharmik Thakkar <[email protected]>
Cc: [email protected]; Gobriel, Sameh <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH] lib/hash: remove unnecessary locks in lock-free

25/11/2019 19:49, Wang, Yipeng1:

Quoted 14 lines
Quoted 14 lines

-----Original Message-----
From: Dharmik Thakkar [mailto:[email protected]]
Sent: Thursday, November 21, 2019 10:18 AM
To: Wang, Yipeng1 <[email protected]>; Gobriel, Sameh <[email protected]>; Richardson, Bruce <[email protected]>
Cc: [email protected]; [email protected]; Dharmik Thakkar <[email protected]>
Subject: [PATCH] lib/hash: remove unnecessary locks in lock-free

Remove __hash_rw_reader_unlock() calls from lock free hash lookup

---

Quoted 7 lines
Quoted 3 lines

Thanks for the patch!

Excuse me, there is no motivation (the why) in this patch. Is it critical? which gain?

[Wang, Yipeng]
Thomas, do you mean the commit message is not clear enough?
I think it is self-explained that in the "lock-free" implementation, we don't need "read_unlock()" and the subject line also says that.
But it is always better to be more explicit.

#4 lore raw

25/11/2019 23:02, Wang, Yipeng1:

Quoted 14 lines

From: Thomas Monjalon [mailto:[email protected]]

Quoted 13 lines

25/11/2019 19:49, Wang, Yipeng1:

Quoted 11 lines

From: Dharmik Thakkar [mailto:[email protected]]

Quoted 7 lines

Remove __hash_rw_reader_unlock() calls from lock free hash lookup

---

Thanks for the patch!

Quoted 8 lines
Quoted 3 lines

Excuse me, there is no motivation (the why) in this patch. Is it critical? which gain?

[Wang, Yipeng]
Thomas, do you mean the commit message is not clear enough?
I think it is self-explained that in the "lock-free" implementation, we don't need "read_unlock()" and the subject line also says that.
But it is always better to be more explicit.

I understand that it is not needed.
But it doesn't say what is the impact of having this unlock.
Is there a real performance impact?
Is it critical enough to be merged in 19.11-rc4?
If it is not candidate for 19.11, it is better to prepend the title with [20.02].

#5 lore raw
Quoted 28 lines · Thomas Monjalon

25/11/2019 23:02, Wang, Yipeng1:

Quoted 14 lines

From: Thomas Monjalon [mailto:[email protected]]

Quoted 13 lines

25/11/2019 19:49, Wang, Yipeng1:

Quoted 11 lines

From: Dharmik Thakkar [mailto:[email protected]]

Quoted 7 lines

Remove __hash_rw_reader_unlock() calls from lock free hash lookup

---

Thanks for the patch!

Quoted 8 lines
Quoted 3 lines

Excuse me, there is no motivation (the why) in this patch. Is it critical? which gain?

[Wang, Yipeng]
Thomas, do you mean the commit message is not clear enough?
I think it is self-explained that in the "lock-free" implementation, we don't need "read_unlock()" and the subject line also says that.
But it is always better to be more explicit.

Quoted 6 lines

I understand that it is not needed.
But it doesn't say what is the impact of having this unlock.
Is there a real performance impact?
Is it critical enough to be merged in 19.11-rc4?
If it is not candidate for 19.11, it is better to prepend the title with [20.02].

Thomas, I don’t think there is any performance impact. This is more of a clean-up patch. It is not critical as those “read_unlock()” don’t cause any error.
Should I update the patch title with [20.02]?

Quoted 1 line

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#6 lore raw

25/11/2019 23:55, Dharmik Thakkar:

Quoted 33 lines
Quoted 27 lines · Thomas Monjalon

25/11/2019 23:02, Wang, Yipeng1:

Quoted 14 lines

From: Thomas Monjalon [mailto:[email protected]]

Quoted 13 lines

25/11/2019 19:49, Wang, Yipeng1:

Quoted 11 lines

From: Dharmik Thakkar [mailto:[email protected]]

Quoted 7 lines

Remove __hash_rw_reader_unlock() calls from lock free hash lookup

---

Thanks for the patch!

Quoted 8 lines
Quoted 3 lines

Excuse me, there is no motivation (the why) in this patch. Is it critical? which gain?

[Wang, Yipeng]
Thomas, do you mean the commit message is not clear enough?
I think it is self-explained that in the "lock-free" implementation, we don't need "read_unlock()" and the subject line also says that.
But it is always better to be more explicit.

Quoted 6 lines

I understand that it is not needed.
But it doesn't say what is the impact of having this unlock.
Is there a real performance impact?
Is it critical enough to be merged in 19.11-rc4?
If it is not candidate for 19.11, it is better to prepend the title with [20.02].

Quoted 3 lines

Thomas, I don’t think there is any performance impact. This is more of a clean-up patch. It is not critical as those “read_unlock()” don’t cause any error.
Should I update the patch title with [20.02]?

No that's fine, it's clear now.
Thank you

#7 lore raw

Hi Thomas,
Can this patch be merged?

Quoted 36 lines · Thomas Monjalon

25/11/2019 23:55, Dharmik Thakkar:

Quoted 33 lines
Quoted 33 lines · Thomas Monjalon

25/11/2019 23:02, Wang, Yipeng1:

Quoted 14 lines

From: Thomas Monjalon [mailto:[email protected]]

Quoted 13 lines

25/11/2019 19:49, Wang, Yipeng1:

Quoted 11 lines

From: Dharmik Thakkar [mailto:[email protected]]

Quoted 7 lines

Remove __hash_rw_reader_unlock() calls from lock free hash lookup

---

Thanks for the patch!

Quoted 8 lines
Quoted 3 lines

Excuse me, there is no motivation (the why) in this patch. Is it critical? which gain?

[Wang, Yipeng]
Thomas, do you mean the commit message is not clear enough?
I think it is self-explained that in the "lock-free" implementation, we don't need "read_unlock()" and the subject line also says that.
But it is always better to be more explicit.

I understand that it is not needed.
But it doesn't say what is the impact of having this unlock.
Is there a real performance impact?
Is it critical enough to be merged in 19.11-rc4?
If it is not candidate for 19.11, it is better to prepend the title with [20.02].

Quoted 6 lines
Quoted 3 lines

Thomas, I don’t think there is any performance impact. This is more of a clean-up patch. It is not critical as those “read_unlock()” don’t cause any error.
Should I update the patch title with [20.02]?

No that's fine, it's clear now.
Thank you

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.