DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wang, Yipeng1" <yipeng1.wang@intel.com>
To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: "Richardson, Bruce" <bruce.richardson@intel.com>,
	"De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"Dharmik Thakkar" <Dharmik.Thakkar@arm.com>,
	"Gavin Hu (Arm Technology China)" <Gavin.Hu@arm.com>,
	nd <nd@arm.com>, "thomas@monjalon.net" <thomas@monjalon.net>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>,
	"hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
	"chaozhu@linux.vnet.ibm.com" <chaozhu@linux.vnet.ibm.com>,
	nd <nd@arm.com>, "Gobriel, Sameh" <sameh.gobriel@intel.com>
Subject: Re: [dpdk-dev] [PATCH v7 4/5] hash: add lock-free read-write concurrency
Date: Wed, 7 Nov 2018 02:15:33 +0000	[thread overview]
Message-ID: <D2C4A16CA39F7F4E8E384D204491D7A661514290@ORSMSX105.amr.corp.intel.com> (raw)
In-Reply-To: <AM6PR08MB3672DD10D2BEAEB58599B7BD98CB0@AM6PR08MB3672.eurprd08.prod.outlook.com>

>-----Original Message-----
>From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com]
>Sent: Monday, November 5, 2018 10:08 PM
>To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>Cc: Richardson, Bruce <bruce.richardson@intel.com>; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; dev@dpdk.org; Wang,
>Yipeng1 <yipeng1.wang@intel.com>; Dharmik Thakkar <Dharmik.Thakkar@arm.com>; Gavin Hu (Arm Technology China)
><Gavin.Hu@arm.com>; nd <nd@arm.com>; thomas@monjalon.net; Yigit, Ferruh <ferruh.yigit@intel.com>;
>hemant.agrawal@nxp.com; chaozhu@linux.vnet.ibm.com; nd <nd@arm.com>
>Subject: RE: [dpdk-dev] [PATCH v7 4/5] hash: add lock-free read-write concurrency
>> >
>> > 9) Does anyone else facing this problem?
>Any data on x86?
>
[Wang, Yipeng] 
I tried Jerin's tests on x86. So by default l3fwd on x86 will use lookup_bulk and SIMD instruction so there is no obvious throughput
drop on both hit and miss cases (for hit case, there is about 2.5% drop though).

I manually changed l3fwd  to do single packet lookup instead of bulk. For hit case there is no throughput drop.
For miss case, there is 10% throughput drop.

I dig into it, as expected, atomic load indeed translates to regular mov on x86. 
But since the reordering of the instruction, the compiler(gcc 5.4)
cannot unroll the for loop to a switch-case like assembly as before. 
So I believe the reason of performance drops on x86 is because compiler cannot optimize the code as well as previously.
I guess this is totally different reason from why
your performance drop on non-TSO machine. On non-TSO machine, probably the excessive number of atomic load
causes a lot of overhead.

A quick fix I found useful on x86 is to read all index together. I am no expert on the use of atomic intinsics, but I assume
By adding a fence should still maintain the correct ordering?
-       uint32_t key_idx;
+       uint32_t key_idx[RTE_HASH_BUCKET_ENTRIES];
        void *pdata;
        struct rte_hash_key *k, *keys = h->key_store;

+       memcpy(key_idx, bkt->key_idx, 4 * RTE_HASH_BUCKET_ENTRIES);
+       __atomic_thread_fence(__ATOMIC_ACQUIRE);
+
        for (i = 0; i < RTE_HASH_BUCKET_ENTRIES; i++) {
-               key_idx = __atomic_load_n(&bkt->key_idx[i],
-                                         __ATOMIC_ACQUIRE);
-               if (bkt->sig_current[i] == sig && key_idx != EMPTY_SLOT) {
+               if (bkt->sig_current[i] == sig && key_idx[i] != EMPTY_SLOT){

Yipeng

  parent reply	other threads:[~2018-11-07  2:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26  5:37 [dpdk-dev] [PATCH v7 0/5] Address reader-writer concurrency in rte_hash Honnappa Nagarahalli
2018-10-26  5:37 ` [dpdk-dev] [PATCH v7 1/5] hash: separate multi-writer from rw-concurrency Honnappa Nagarahalli
2018-10-26  5:37 ` [dpdk-dev] [PATCH v7 2/5] hash: support do not free on delete Honnappa Nagarahalli
2018-10-26  5:37 ` [dpdk-dev] [PATCH v7 3/5] hash: fix key store element alignment Honnappa Nagarahalli
2018-10-26  5:37 ` [dpdk-dev] [PATCH v7 4/5] hash: add lock-free read-write concurrency Honnappa Nagarahalli
2018-11-03 11:52   ` Jerin Jacob
2018-11-03 15:40     ` Jerin Jacob
2018-11-06  6:07       ` Honnappa Nagarahalli
2018-11-06  9:10         ` Jerin Jacob
2018-11-06  9:13           ` Thomas Monjalon
2018-11-06  9:47             ` Jerin Jacob
2018-11-09  1:34           ` Honnappa Nagarahalli
2018-11-09  2:20             ` Honnappa Nagarahalli
2018-11-09  9:28             ` Jerin Jacob
2018-11-09 15:37               ` Honnappa Nagarahalli
2018-11-07  2:15         ` Wang, Yipeng1 [this message]
2018-11-09  0:47           ` Honnappa Nagarahalli
2018-10-26  5:37 ` [dpdk-dev] [PATCH v7 5/5] test/hash: read-write lock-free concurrency test Honnappa Nagarahalli
2018-10-26 10:52 ` [dpdk-dev] [PATCH v7 0/5] Address reader-writer concurrency in rte_hash 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=D2C4A16CA39F7F4E8E384D204491D7A661514290@ORSMSX105.amr.corp.intel.com \
    --to=yipeng1.wang@intel.com \
    --cc=Dharmik.Thakkar@arm.com \
    --cc=Gavin.Hu@arm.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=bruce.richardson@intel.com \
    --cc=chaozhu@linux.vnet.ibm.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=nd@arm.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=sameh.gobriel@intel.com \
    --cc=thomas@monjalon.net \
    /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).