From patchwork Mon Nov 8 17:39:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Medvedkin X-Patchwork-Id: 104015 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C3436A0C4E; Mon, 8 Nov 2021 18:50:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8280740DF7; Mon, 8 Nov 2021 18:50:36 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id E966040151 for ; Mon, 8 Nov 2021 18:50:34 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="229749617" X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="229749617" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 09:39:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="503124479" Received: from silpixa00400072.ir.intel.com (HELO silpixa00400072.ger.corp.intel.com) ([10.237.222.91]) by orsmga008.jf.intel.com with ESMTP; 08 Nov 2021 09:39:43 -0800 From: Vladimir Medvedkin To: dev@dpdk.org Cc: thomas@monjalon.net, Yipeng Wang , Sameh Gobriel , Bruce Richardson Date: Mon, 8 Nov 2021 17:39:35 +0000 Message-Id: <20211108173935.133310-1-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] hash: clarify comments for RTE_HASH_BUCKET_ENTRIES X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds a comment for RTE_HASH_BUCKET_ENTRIES explaining why a particular value was chosen. Signed-off-by: Vladimir Medvedkin --- 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. + */ #define RTE_HASH_BUCKET_ENTRIES 8 #if !RTE_IS_POWER_OF_2(RTE_HASH_BUCKET_ENTRIES)