[v2] hash: clarify comments for RTE_HASH_BUCKET_ENTRIES

Message ID 20211110183614.218540-1-vladimir.medvedkin@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] hash: clarify comments for RTE_HASH_BUCKET_ENTRIES |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Vladimir Medvedkin Nov. 10, 2021, 6:36 p.m. UTC
  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(-)
  

Comments

Honnappa Nagarahalli Nov. 10, 2021, 7:16 p.m. UTC | #1
<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>
Looks good
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.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..eb2644f74b 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, multiple 'struct rte_hash_bucket' can be fit
> + * on a single cache line (64 or 128 bytes long) without any gaps
> + * in memory between them due to alignment.
> + */
>  #define RTE_HASH_BUCKET_ENTRIES		8
> 
>  #if !RTE_IS_POWER_OF_2(RTE_HASH_BUCKET_ENTRIES)
> --
> 2.25.1
  
Thomas Monjalon Nov. 17, 2021, 5:34 p.m. UTC | #2
> > 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>
> Looks good
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

Applied, thanks.
  

Patch

diff --git a/lib/hash/rte_cuckoo_hash.h b/lib/hash/rte_cuckoo_hash.h
index 85be49d3bb..eb2644f74b 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, multiple 'struct rte_hash_bucket' can be fit
+ * on a single cache line (64 or 128 bytes long) without any gaps
+ * in memory between them due to alignment.
+ */
 #define RTE_HASH_BUCKET_ENTRIES		8
 
 #if !RTE_IS_POWER_OF_2(RTE_HASH_BUCKET_ENTRIES)