DPDK usage discussions
 help / color / mirror / Atom feed
* Doubt regarding DPDK hash Library implementation
@ 2021-11-01 10:55 Syam Prasad N Pearson
  2021-11-04 14:11 ` [dpdk-dev] " Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Syam Prasad N Pearson @ 2021-11-01 10:55 UTC (permalink / raw)
  To: users, dev; +Cc: Syam Prasad N Pearson

[-- Attachment #1: Type: text/plain, Size: 998 bytes --]

Dear Sir/Madam,
I am a developer trying to get familiar with the DPDK hash library. I tried
to make and use a hash table successfully.
During the development I came across a variable

/** Number of items per bucket. */
*#define RTE_HASH_BUCKET_ENTRIES 8*

defined inside:
dpdk-20.11.3/dpdk-stable-20.11.3/lib/librte_hash /rte_cuckoo_hash.h

Why does the library take this value as *8*, is there any particular reason
for this? what if it is 16,32... etc.

I am using DPDK 20.11.3 LTS.

Please help.

-- 
Regards,
Syam Pearson
Syam Pearson
Gadgeon Smart Systems
m: +91-97460-44420 (India)
w: www.gadgeon.com
<https://link.aeusercontent.com/mt/lt/D78C05ADDA56BE856A051569556899538/1?targetURL=https%3A%2F%2Fwww.gadgeon.com%2F>
www.delpheon.io
<https://link.aeusercontent.com/mt/lt/D78C05ADDA56BE856A051569556899538/2?targetURL=https%3A%2F%2Fdelpheon.io%2F>

<https://twitter.com/gadgeon>  [image:
www.linkedin.com/in/kirankumar-c-32349964]
<http://www.linkedin.com/in/syam-prasad-n-pearson-4903b5a8>

[-- Attachment #2: Type: text/html, Size: 7020 bytes --]

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

* Re: [dpdk-dev] Doubt regarding DPDK hash Library implementation
  2021-11-01 10:55 Doubt regarding DPDK hash Library implementation Syam Prasad N Pearson
@ 2021-11-04 14:11 ` Thomas Monjalon
  2021-11-04 14:46   ` Kinsella, Ray
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2021-11-04 14:11 UTC (permalink / raw)
  To: Syam Prasad N Pearson
  Cc: users, dev, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
	Vladimir Medvedkin

+Cc hash lib maintainers

01/11/2021 11:55, Syam Prasad N Pearson:
> Dear Sir/Madam,
> I am a developer trying to get familiar with the DPDK hash library. I tried
> to make and use a hash table successfully.
> During the development I came across a variable
> 
> /** Number of items per bucket. */
> *#define RTE_HASH_BUCKET_ENTRIES 8*
> 
> defined inside:
> dpdk-20.11.3/dpdk-stable-20.11.3/lib/librte_hash /rte_cuckoo_hash.h
> 
> Why does the library take this value as *8*, is there any particular reason
> for this? what if it is 16,32... etc.
> 
> I am using DPDK 20.11.3 LTS.
> 
> Please help.




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

* RE: [dpdk-dev] Doubt regarding DPDK hash Library implementation
  2021-11-04 14:11 ` [dpdk-dev] " Thomas Monjalon
@ 2021-11-04 14:46   ` Kinsella, Ray
  2021-11-04 16:39     ` Medvedkin, Vladimir
  0 siblings, 1 reply; 6+ messages in thread
From: Kinsella, Ray @ 2021-11-04 14:46 UTC (permalink / raw)
  To: Thomas Monjalon, Syam Prasad N Pearson
  Cc: users, dev, Wang, Yipeng1, Gobriel, Sameh, Richardson, Bruce,
	Medvedkin, Vladimir

I would guess it - I would say it is related to cache alignment.
Assuming each entry is 8 bytes 😊

Ray K

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Thursday 4 November 2021 14:12
> To: Syam Prasad N Pearson <syam.pearson@gadgeon.com>
> Cc: users@dpdk.org; dev@dpdk.org; Wang, Yipeng1
> <yipeng1.wang@intel.com>; Gobriel, Sameh <sameh.gobriel@intel.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; Medvedkin, Vladimir
> <vladimir.medvedkin@intel.com>
> Subject: Re: [dpdk-dev] Doubt regarding DPDK hash Library
> implementation
> 
> +Cc hash lib maintainers
> 
> 01/11/2021 11:55, Syam Prasad N Pearson:
> > Dear Sir/Madam,
> > I am a developer trying to get familiar with the DPDK hash library.
> I
> > tried to make and use a hash table successfully.
> > During the development I came across a variable
> >
> > /** Number of items per bucket. */
> > *#define RTE_HASH_BUCKET_ENTRIES 8*
> >
> > defined inside:
> > dpdk-20.11.3/dpdk-stable-20.11.3/lib/librte_hash /rte_cuckoo_hash.h
> >
> > Why does the library take this value as *8*, is there any particular
> > reason for this? what if it is 16,32... etc.
> >
> > I am using DPDK 20.11.3 LTS.
> >
> > Please help.
> 
> 


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

* Re: [dpdk-dev] Doubt regarding DPDK hash Library implementation
  2021-11-04 14:46   ` Kinsella, Ray
@ 2021-11-04 16:39     ` Medvedkin, Vladimir
  2021-11-04 16:49       ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Medvedkin, Vladimir @ 2021-11-04 16:39 UTC (permalink / raw)
  To: Kinsella, Ray, Thomas Monjalon, Syam Prasad N Pearson
  Cc: users, dev, Wang, Yipeng1, Gobriel, Sameh, Richardson, Bruce

Hello,

On 04/11/2021 15:46, Kinsella, Ray wrote:
> I would guess it - I would say it is related to cache alignment.
> Assuming each entry is 8 bytes 😊
> 
> Ray K
> 
>> -----Original Message-----
>> From: Thomas Monjalon <thomas@monjalon.net>
>> Sent: Thursday 4 November 2021 14:12
>> To: Syam Prasad N Pearson <syam.pearson@gadgeon.com>
>> Cc: users@dpdk.org; dev@dpdk.org; Wang, Yipeng1
>> <yipeng1.wang@intel.com>; Gobriel, Sameh <sameh.gobriel@intel.com>;
>> Richardson, Bruce <bruce.richardson@intel.com>; Medvedkin, Vladimir
>> <vladimir.medvedkin@intel.com>
>> Subject: Re: [dpdk-dev] Doubt regarding DPDK hash Library
>> implementation
>>
>> +Cc hash lib maintainers
>>
>> 01/11/2021 11:55, Syam Prasad N Pearson:
>>> Dear Sir/Madam,
>>> I am a developer trying to get familiar with the DPDK hash library.
>> I
>>> tried to make and use a hash table successfully.
>>> During the development I came across a variable
>>>
>>> /** Number of items per bucket. */
>>> *#define RTE_HASH_BUCKET_ENTRIES 8*
>>>
>>> defined inside:
>>> dpdk-20.11.3/dpdk-stable-20.11.3/lib/librte_hash /rte_cuckoo_hash.h
>>>
>>> Why does the library take this value as *8*, is there any particular
>>> reason for this? what if it is 16,32... etc.
>>>

Yes, RTE_HASH_BUCKET_ENTRIES can be any power of 2.
The reason for choosing 8 is a tradeoff between performance and memory. 
When it is equal to 8, the sizeof(struct rte_hash_bucket) equal to 
RTE_CACHE_LINE_SIZE, thus, there are no gaps in memory between the hash 
buckets due to their alignment.

>>> I am using DPDK 20.11.3 LTS.
>>>
>>> Please help.
>>
>>
> 

-- 
Regards,
Vladimir

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

* Re: [dpdk-dev] Doubt regarding DPDK hash Library implementation
  2021-11-04 16:39     ` Medvedkin, Vladimir
@ 2021-11-04 16:49       ` Thomas Monjalon
  2021-11-06 23:23         ` Syam Prasad N Pearson
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2021-11-04 16:49 UTC (permalink / raw)
  To: Medvedkin, Vladimir
  Cc: Kinsella, Ray, Syam Prasad N Pearson, users, dev, Wang, Yipeng1,
	Gobriel, Sameh, Richardson, Bruce

04/11/2021 17:39, Medvedkin, Vladimir:
> >> 01/11/2021 11:55, Syam Prasad N Pearson:
> >>> /** Number of items per bucket. */
> >>> *#define RTE_HASH_BUCKET_ENTRIES 8*
> >>>
> >>> defined inside:
> >>> dpdk-20.11.3/dpdk-stable-20.11.3/lib/librte_hash /rte_cuckoo_hash.h
> >>>
> >>> Why does the library take this value as *8*, is there any particular
> >>> reason for this? what if it is 16,32... etc.
> 
> Yes, RTE_HASH_BUCKET_ENTRIES can be any power of 2.
> The reason for choosing 8 is a tradeoff between performance and memory. 
> When it is equal to 8, the sizeof(struct rte_hash_bucket) equal to 
> RTE_CACHE_LINE_SIZE, thus, there are no gaps in memory between the hash 
> buckets due to their alignment.

That's a good comment to add in the code.



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

* Re: [dpdk-dev] Doubt regarding DPDK hash Library implementation
  2021-11-04 16:49       ` Thomas Monjalon
@ 2021-11-06 23:23         ` Syam Prasad N Pearson
  0 siblings, 0 replies; 6+ messages in thread
From: Syam Prasad N Pearson @ 2021-11-06 23:23 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Medvedkin, Vladimir, Kinsella, Ray, users, dev, Wang, Yipeng1,
	Gobriel, Sameh, Richardson, Bruce

[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]

Thank you all.

On Thu, Nov 4, 2021 at 10:19 PM Thomas Monjalon <thomas@monjalon.net> wrote:

> 04/11/2021 17:39, Medvedkin, Vladimir:
> > >> 01/11/2021 11:55, Syam Prasad N Pearson:
> > >>> /** Number of items per bucket. */
> > >>> *#define RTE_HASH_BUCKET_ENTRIES 8*
> > >>>
> > >>> defined inside:
> > >>> dpdk-20.11.3/dpdk-stable-20.11.3/lib/librte_hash /rte_cuckoo_hash.h
> > >>>
> > >>> Why does the library take this value as *8*, is there any particular
> > >>> reason for this? what if it is 16,32... etc.
> >
> > Yes, RTE_HASH_BUCKET_ENTRIES can be any power of 2.
> > The reason for choosing 8 is a tradeoff between performance and memory.
> > When it is equal to 8, the sizeof(struct rte_hash_bucket) equal to
> > RTE_CACHE_LINE_SIZE, thus, there are no gaps in memory between the hash
> > buckets due to their alignment.
>
> That's a good comment to add in the code.
>
>
>

-- 
Regards,
Syam Pearson
Syam Pearson
Gadgeon Smart Systems
m: +91-97460-44420 (India)
w: www.gadgeon.com
<https://link.aeusercontent.com/mt/lt/D78C05ADDA56BE856A051569556899538/1?targetURL=https%3A%2F%2Fwww.gadgeon.com%2F>
www.delpheon.io
<https://link.aeusercontent.com/mt/lt/D78C05ADDA56BE856A051569556899538/2?targetURL=https%3A%2F%2Fdelpheon.io%2F>

<https://twitter.com/gadgeon>  [image:
www.linkedin.com/in/kirankumar-c-32349964]
<http://www.linkedin.com/in/syam-prasad-n-pearson-4903b5a8>

[-- Attachment #2: Type: text/html, Size: 7676 bytes --]

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

end of thread, other threads:[~2021-11-07 15:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01 10:55 Doubt regarding DPDK hash Library implementation Syam Prasad N Pearson
2021-11-04 14:11 ` [dpdk-dev] " Thomas Monjalon
2021-11-04 14:46   ` Kinsella, Ray
2021-11-04 16:39     ` Medvedkin, Vladimir
2021-11-04 16:49       ` Thomas Monjalon
2021-11-06 23:23         ` Syam Prasad N Pearson

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