[dpdk-dev] Doubt regarding DPDK hash Library implementation

Medvedkin, Vladimir vladimir.medvedkin at intel.com
Thu Nov 4 17:39:50 CET 2021


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 at monjalon.net>
>> Sent: Thursday 4 November 2021 14:12
>> To: Syam Prasad N Pearson <syam.pearson at gadgeon.com>
>> Cc: users at dpdk.org; dev at dpdk.org; Wang, Yipeng1
>> <yipeng1.wang at intel.com>; Gobriel, Sameh <sameh.gobriel at intel.com>;
>> Richardson, Bruce <bruce.richardson at intel.com>; Medvedkin, Vladimir
>> <vladimir.medvedkin at 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


More information about the dev mailing list