lib/hash: remove unnecessary locks in lock-free
Checks
Commit Message
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(-)
Comments
>-----Original Message-----
>From: Dharmik Thakkar [mailto:dharmik.thakkar@arm.com]
>Sent: Thursday, November 21, 2019 10:18 AM
>To: Wang, Yipeng1 <yipeng1.wang@intel.com>; Gobriel, Sameh <sameh.gobriel@intel.com>; Richardson, Bruce
><bruce.richardson@intel.com>
>Cc: dev@dpdk.org; honnappa.nagarahalli@arm.com; Dharmik Thakkar <dharmik.thakkar@arm.com>
>Subject: [PATCH] lib/hash: remove unnecessary locks in lock-free
>
>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>
>---
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
Thanks for the patch!
25/11/2019 19:49, Wang, Yipeng1:
> >-----Original Message-----
> >From: Dharmik Thakkar [mailto:dharmik.thakkar@arm.com]
> >Sent: Thursday, November 21, 2019 10:18 AM
> >To: Wang, Yipeng1 <yipeng1.wang@intel.com>; Gobriel, Sameh <sameh.gobriel@intel.com>; Richardson, Bruce
> ><bruce.richardson@intel.com>
> >Cc: dev@dpdk.org; honnappa.nagarahalli@arm.com; Dharmik Thakkar <dharmik.thakkar@arm.com>
> >Subject: [PATCH] lib/hash: remove unnecessary locks in lock-free
> >
> >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>
> >---
> Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
>
> Thanks for the patch!
Excuse me, there is no motivation (the why) in this patch.
Is it critical? which gain?
>-----Original Message-----
>From: Thomas Monjalon [mailto:thomas@monjalon.net]
>Sent: Monday, November 25, 2019 1:55 PM
>To: Wang, Yipeng1 <yipeng1.wang@intel.com>; Dharmik Thakkar <dharmik.thakkar@arm.com>
>Cc: dev@dpdk.org; Gobriel, Sameh <sameh.gobriel@intel.com>; Richardson, Bruce <bruce.richardson@intel.com>;
>honnappa.nagarahalli@arm.com
>Subject: Re: [dpdk-dev] [PATCH] lib/hash: remove unnecessary locks in lock-free
>
>25/11/2019 19:49, Wang, Yipeng1:
>> >-----Original Message-----
>> >From: Dharmik Thakkar [mailto:dharmik.thakkar@arm.com]
>> >Sent: Thursday, November 21, 2019 10:18 AM
>> >To: Wang, Yipeng1 <yipeng1.wang@intel.com>; Gobriel, Sameh <sameh.gobriel@intel.com>; Richardson, Bruce
>> ><bruce.richardson@intel.com>
>> >Cc: dev@dpdk.org; honnappa.nagarahalli@arm.com; Dharmik Thakkar <dharmik.thakkar@arm.com>
>> >Subject: [PATCH] lib/hash: remove unnecessary locks in lock-free
>> >
>> >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>
>> >---
>> Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
>>
>> 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.
25/11/2019 23:02, Wang, Yipeng1:
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> >25/11/2019 19:49, Wang, Yipeng1:
> >> From: Dharmik Thakkar [mailto:dharmik.thakkar@arm.com]
> >> >
> >> >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>
> >> >---
> >> Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
> >>
> >> 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.
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].
> On Nov 25, 2019, at 4:44 PM, Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 25/11/2019 23:02, Wang, Yipeng1:
>> From: Thomas Monjalon [mailto:thomas@monjalon.net]
>>> 25/11/2019 19:49, Wang, Yipeng1:
>>>> From: Dharmik Thakkar [mailto:dharmik.thakkar@arm.com]
>>>>>
>>>>> 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>
>>>>> ---
>>>> Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
>>>>
>>>> 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.
>
> 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]?
>
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.
25/11/2019 23:55, Dharmik Thakkar:
>
> > On Nov 25, 2019, at 4:44 PM, Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > 25/11/2019 23:02, Wang, Yipeng1:
> >> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> >>> 25/11/2019 19:49, Wang, Yipeng1:
> >>>> From: Dharmik Thakkar [mailto:dharmik.thakkar@arm.com]
> >>>>>
> >>>>> 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>
> >>>>> ---
> >>>> Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
> >>>>
> >>>> 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.
> >
> > 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]?
No that's fine, it's clear now.
Thank you
Hi Thomas,
Can this patch be merged?
> On Nov 25, 2019, at 5:14 PM, Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 25/11/2019 23:55, Dharmik Thakkar:
>>
>>> On Nov 25, 2019, at 4:44 PM, Thomas Monjalon <thomas@monjalon.net> wrote:
>>>
>>> 25/11/2019 23:02, Wang, Yipeng1:
>>>> From: Thomas Monjalon [mailto:thomas@monjalon.net]
>>>>> 25/11/2019 19:49, Wang, Yipeng1:
>>>>>> From: Dharmik Thakkar [mailto:dharmik.thakkar@arm.com]
>>>>>>>
>>>>>>> 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>
>>>>>>> ---
>>>>>> Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
>>>>>>
>>>>>> 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.
>>>
>>> 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]?
>
> 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.
25/11/2019 19:49, Wang, Yipeng1:
>From: Dharmik Thakkar [mailto:dharmik.thakkar@arm.com]
> >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>
> >---
> Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
Applied, thanks
@@ -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