From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Richardson, Bruce" <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3 1/4] hash: reorder hash structure
Date: Thu, 29 Sep 2016 01:33:12 +0000 [thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D8973CA00EA9@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <20160928090240.GA47356@bricha3-MOBL3>
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Wednesday, September 28, 2016 2:03 AM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org
> Subject: Re: [PATCH v3 1/4] hash: reorder hash structure
>
> On Tue, Sep 06, 2016 at 08:34:01PM +0100, Pablo de Lara wrote:
> > In order to optimize lookup performance, hash structure
> > is reordered, so all fields used for lookup will be
> > in the first cache line.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
> > lib/librte_hash/rte_cuckoo_hash.h | 12 +++++++-----
> > 1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/lib/librte_hash/rte_cuckoo_hash.h
> b/lib/librte_hash/rte_cuckoo_hash.h
> > index e290dab..701531a 100644
> > --- a/lib/librte_hash/rte_cuckoo_hash.h
> > +++ b/lib/librte_hash/rte_cuckoo_hash.h
> > @@ -182,9 +182,7 @@ struct rte_hash_bucket {
> >
> > /** A hash table structure. */
> > struct rte_hash {
> > - char name[RTE_HASH_NAMESIZE]; /**< Name of the hash. */
> > - uint32_t entries; /**< Total table entries. */
> > - uint32_t num_buckets; /**< Number of buckets in table. */
> > + /* first cache line - fields used in lookup */
> > uint32_t key_len; /**< Length of hash key. */
> > rte_hash_function hash_func; /**< Function used to calculate hash.
> */
> > uint32_t hash_func_init_val; /**< Init value used by hash_func. */
> > @@ -196,12 +194,13 @@ struct rte_hash {
> > from hash signature. */
> > uint32_t key_entry_size; /**< Size of each key entry. */
> >
> > - struct rte_ring *free_slots; /**< Ring that stores all indexes
> > - of the free slots in the key
> table */
> > void *key_store; /**< Table storing all keys and data */
> > struct rte_hash_bucket *buckets; /**< Table with buckets
> storing all the
> > hash values and key
> indexes
> > to the key table*/
> > +
> > + struct rte_ring *free_slots; /**< Ring that stores all indexes
> > + of the free slots in the key
> table */
> > uint8_t hw_trans_mem_support; /**< Hardware transactional
> > memory support */
> > struct lcore_cache *local_free_slots;
> > @@ -209,6 +208,9 @@ struct rte_hash {
> > enum add_key_case add_key; /**< Multi-writer hash add behavior */
> >
> > rte_spinlock_t *multiwriter_lock; /**< Multi-writer spinlock for w/o
> TM */
> > + char name[RTE_HASH_NAMESIZE]; /**< Name of the hash. */
> > + uint32_t entries; /**< Total table entries. */
> > + uint32_t num_buckets; /**< Number of buckets in table. */
>
> Hi Pablo,
>
> While I've no strong objection to the change, having the name at the start
> is a common paradigm in DPDK. Rather than place these fields at the end,
> can you get the same effect by just marking the key_len function
> __rte_cache_aligned? It may use a little more memory per table, but given
> that
> the size of the hash table is going to be largely governed by the table data,
> I don't see an extra 64 bytes in the structure as being an issue.
Hi Bruce,
Sure, sounds good to me. I was trying a similar approach to the mbuf structure,
and actually I saw a small performance boost doing this,
so I can push the fields needed for lookup for the second cache line instead,
it should work the same :)
Thanks,
Pablo
>
> Regards,
> /Bruce
next prev parent reply other threads:[~2016-09-29 1:33 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 21:34 [dpdk-dev] [PATCH 0/3] Cuckoo hash lookup enhancements Pablo de Lara
2016-08-26 21:34 ` [dpdk-dev] [PATCH 1/3] hash: reorganize bucket structure Pablo de Lara
2016-08-26 21:34 ` [dpdk-dev] [PATCH 2/3] hash: add vectorized comparison Pablo de Lara
2016-08-27 8:57 ` Thomas Monjalon
2016-09-02 17:05 ` De Lara Guarch, Pablo
2016-08-26 21:34 ` [dpdk-dev] [PATCH 3/3] hash: modify lookup bulk pipeline Pablo de Lara
2016-09-02 22:56 ` [dpdk-dev] [PATCH v2 0/4] Cuckoo hash lookup enhancements Pablo de Lara
2016-09-02 22:56 ` [dpdk-dev] [PATCH v2 1/4] hash: reorder hash structure Pablo de Lara
2016-09-02 22:56 ` [dpdk-dev] [PATCH v2 2/4] hash: reorganize bucket structure Pablo de Lara
2016-09-02 22:56 ` [dpdk-dev] [PATCH v2 3/4] hash: add vectorized comparison Pablo de Lara
2016-09-02 22:56 ` [dpdk-dev] [PATCH v2 4/4] hash: modify lookup bulk pipeline Pablo de Lara
2016-09-06 19:33 ` [dpdk-dev] [PATCH v3 0/4] Cuckoo hash lookup enhancements Pablo de Lara
2016-09-30 7:38 ` [dpdk-dev] [PATCH v4 0/4] Cuckoo hash enhancements Pablo de Lara
2016-09-30 7:38 ` [dpdk-dev] [PATCH v4 1/4] hash: reorder hash structure Pablo de Lara
2016-09-30 7:38 ` [dpdk-dev] [PATCH v4 2/4] hash: reorganize bucket structure Pablo de Lara
2016-09-30 7:38 ` [dpdk-dev] [PATCH v4 3/4] hash: add vectorized comparison Pablo de Lara
2016-09-30 7:38 ` [dpdk-dev] [PATCH v4 4/4] hash: modify lookup bulk pipeline Pablo de Lara
2016-09-30 19:53 ` [dpdk-dev] [PATCH v4 0/4] Cuckoo hash enhancements Gobriel, Sameh
2016-10-03 9:59 ` Bruce Richardson
2016-10-04 6:50 ` De Lara Guarch, Pablo
2016-10-04 7:17 ` De Lara Guarch, Pablo
2016-10-04 9:47 ` Bruce Richardson
2016-10-04 23:25 ` [dpdk-dev] [PATCH v5 " Pablo de Lara
2016-10-04 23:25 ` [dpdk-dev] [PATCH v5 1/4] hash: reorder hash structure Pablo de Lara
2016-10-04 23:25 ` [dpdk-dev] [PATCH v5 2/4] hash: reorganize bucket structure Pablo de Lara
2016-10-04 23:25 ` [dpdk-dev] [PATCH v5 3/4] hash: add vectorized comparison Pablo de Lara
2016-10-04 23:25 ` [dpdk-dev] [PATCH v5 4/4] hash: modify lookup bulk pipeline Pablo de Lara
2016-10-05 10:12 ` [dpdk-dev] [PATCH v5 0/4] Cuckoo hash enhancements Thomas Monjalon
2016-09-06 19:34 ` [dpdk-dev] [PATCH v3 0/4] Cuckoo hash lookup enhancements Pablo de Lara
2016-09-06 19:34 ` [dpdk-dev] [PATCH v3 1/4] hash: reorder hash structure Pablo de Lara
2016-09-28 9:02 ` Bruce Richardson
2016-09-29 1:33 ` De Lara Guarch, Pablo [this message]
2016-09-06 19:34 ` [dpdk-dev] [PATCH v3 2/4] hash: reorganize bucket structure Pablo de Lara
2016-09-28 9:05 ` Bruce Richardson
2016-09-29 1:40 ` De Lara Guarch, Pablo
2016-09-06 19:34 ` [dpdk-dev] [PATCH v3 3/4] hash: add vectorized comparison Pablo de Lara
2016-09-06 19:34 ` [dpdk-dev] [PATCH v3 4/4] hash: modify lookup bulk pipeline Pablo de Lara
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=E115CCD9D858EF4F90C690B0DCB4D8973CA00EA9@IRSMSX108.ger.corp.intel.com \
--to=pablo.de.lara.guarch@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/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).