DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "thomas@monjalon.net" <thomas@monjalon.net>,
	Yipeng Wang <yipeng1.wang@intel.com>,
	Sameh Gobriel <sameh.gobriel@intel.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>, nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH] hash: clarify comments for RTE_HASH_BUCKET_ENTRIES
Date: Tue, 9 Nov 2021 20:11:54 +0100	[thread overview]
Message-ID: <792513c3-fbd8-bbb9-bd81-99e96bd3b985@intel.com> (raw)
In-Reply-To: <DBAPR08MB58143F6EB721098BF290A59A98919@DBAPR08MB5814.eurprd08.prod.outlook.com>

Hi Honnappa,

On 08/11/2021 23:04, Honnappa Nagarahalli wrote:
> <snip>
> 
>>
>> This patch adds a comment for RTE_HASH_BUCKET_ENTRIES explaining why a
>> particular value was chosen.
>>
>> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
>> ---
>>   lib/hash/rte_cuckoo_hash.h | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/hash/rte_cuckoo_hash.h b/lib/hash/rte_cuckoo_hash.h index
>> 85be49d3bb..84dc55d86e 100644
>> --- a/lib/hash/rte_cuckoo_hash.h
>> +++ b/lib/hash/rte_cuckoo_hash.h
>> @@ -101,7 +101,13 @@ const rte_hash_cmp_eq_t
>> cmp_jump_table[NUM_KEY_CMP_CASES] = {  #endif
>>
>>
>> -/** Number of items per bucket. */
>> +/**
>> + * Number of items per bucket.
>> + * 8 is a tradeoff between performance and memory consumption.
>> + * 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 think this should consider cache lines which are 128B. How about the following:
> "when it is equal to 8, multiple 'struct rte_hash_bucket' can be fit on a single cache line without any gaps in memory between them".
> 

Sounds good, will add it in v2.

> On the other hand, I am wondering if 'struct rte_hash_bucket' needs to have __rte_cache_aligned attribute. When the memory is allocated for the buckets we are requesting that it is aligned on the cache line boundary. That should be sufficient. Removing the attribute will help for local variables. Some functions (for ex: rte_hash_cuckoo_move_insert_mw) have 2 local variables of this type and they can be placed on the same cache line if this attribute is removed.
> 

I see, however I can't find inside the rte_hash_cuckoo_move_insert_mw() 
'struct rte_hash_bucket' as local variables, there are only pointers:

         struct rte_hash_bucket *cur_bkt;
         struct rte_hash_bucket *prev_bkt, *curr_bkt = leaf->bkt;

Yipeng, Sameh, Bruce, what do you think about removing 
__rte_cache_aligned attribute?

>>   #define RTE_HASH_BUCKET_ENTRIES		8
>>
>>   #if !RTE_IS_POWER_OF_2(RTE_HASH_BUCKET_ENTRIES)
>> --
>> 2.25.1
> 

-- 
Regards,
Vladimir

  reply	other threads:[~2021-11-09 19:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 17:39 Vladimir Medvedkin
2021-11-08 22:04 ` Honnappa Nagarahalli
2021-11-09 19:11   ` Medvedkin, Vladimir [this message]
2021-11-09 19:46     ` Honnappa Nagarahalli
2021-11-10 18:26       ` Wang, Yipeng1
2021-11-10 18:36 ` [PATCH v2] " Vladimir Medvedkin
2021-11-10 19:16   ` Honnappa Nagarahalli
2021-11-17 17:34     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=792513c3-fbd8-bbb9-bd81-99e96bd3b985@intel.com \
    --to=vladimir.medvedkin@intel.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=nd@arm.com \
    --cc=sameh.gobriel@intel.com \
    --cc=thomas@monjalon.net \
    --cc=yipeng1.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).