DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	Ruifeng Wang <ruifeng.wang@arm.com>,
	Yipeng Wang <yipeng1.wang@intel.com>,
	Sameh Gobriel <sameh.gobriel@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [EXT] Re: [PATCH v3 1/2] ip_frag: optimize key compare and hash generation
Date: Tue, 30 May 2023 17:50:35 +0000	[thread overview]
Message-ID: <PH0PR18MB4086844B608EEAF11945AD2ADE4B9@PH0PR18MB4086.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20230529200953.7d7e77f0@hermes.local>

> On Mon, 29 May 2023 20:25:01 +0530
> <pbhagavatula@marvell.com> wrote:
> 
> > +	return (k1->id_key_len != k2->id_key_len) ||
> > +	       (k1->key_len == IPV4_KEYLEN ? k1->src_dst[0] != k2->src_dst[0] :
> > +					     rte_hash_k32_cmp_eq(k1, k2,
> 32));
> 
> If you make another version, one small comment.
> Breaking this into a couple of if statements would make reading easier
> for human readers. Compiler doesn't care.

I have modified the above code to 

       if (k1->id_key_len != k2->id_key_len)
               return 1;
       if (k1->key_len == IPV4_KEYLEN)
               return k1->src_dst[0] != k2->src_dst[0];
       else
               return rte_hash_k32_cmp_eq(k1, k2, 32);

But upon remeasuring performance I see a performance loss of 1.2%
Compiler(GCC 10) generates additional branches with the above code.

I have also profiled the ip_reassembly application with and without the changes and see lot of 
additional branch misses


Current implementation:

==============
Branch Metrics
==============
Branch MPKI                                                  : 0.159             
Branch PKI                                                   : 156.566           
Branch Mis-prediction Rate                                   : 0.101             

INST_RETIRED       : ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 9.493B
BR_RETIRED         : ▇▇▇▇▇▇▇ 1.486B
BR_MIS_PRED_RETIRED: ▏ 1.508M
BR_IMMED_SPEC      : ▇▇▇▇▇▇▇ 1.395B
BR_RETURN_SPEC     : ▏ 105.203M
BR_INDIRECT_SPEC   : ▏ 106.044M

Modified implementation:

==============
Branch Metrics
==============
Branch MPKI                                                  : 0.282             
Branch PKI                                                   : 156.566           
Branch Mis-prediction Rate                                   : 0.180             

INST_RETIRED       : ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 9.444B
BR_RETIRED         : ▇▇▇▇▇▇▇ 1.479B
BR_MIS_PRED_RETIRED: ▏ 2.662M
BR_IMMED_SPEC      : ▇▇▇▇▇▇▇ 1.388B
BR_RETURN_SPEC     : ▏ 104.518M
BR_INDIRECT_SPEC   : ▏ 105.354M


I will retain the current implementation in the next patch.

Thanks,
Pavan.


  reply	other threads:[~2023-05-30 17:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 12:54 [PATCH 1/3] " pbhagavatula
2023-05-23 12:54 ` [PATCH 2/3] ip_frag: improve reassembly lookup performance pbhagavatula
2023-05-23 12:54 ` [PATCH 3/3] test: add reassembly perf test pbhagavatula
2023-05-23 14:39 ` [PATCH v2 1/3] ip_frag: optimize key compare and hash generation pbhagavatula
2023-05-23 14:39   ` [PATCH v2 2/3] ip_frag: improve reassembly lookup performance pbhagavatula
2023-05-23 16:22     ` Honnappa Nagarahalli
2023-05-23 17:58       ` Pavan Nikhilesh Bhagavatula
2023-05-23 22:23         ` Pavan Nikhilesh Bhagavatula
2023-05-23 22:30     ` Stephen Hemminger
2023-05-29 13:17       ` [EXT] " Pavan Nikhilesh Bhagavatula
2023-05-23 14:39   ` [PATCH v2 3/3] test: add reassembly perf test pbhagavatula
2023-05-29 14:55   ` [PATCH v3 1/2] ip_frag: optimize key compare and hash generation pbhagavatula
2023-05-29 14:55     ` [PATCH v3 2/2] test: add reassembly perf test pbhagavatula
2023-05-30 10:51       ` [EXT] " Amit Prakash Shukla
2023-05-30  3:09     ` [PATCH v3 1/2] ip_frag: optimize key compare and hash generation Stephen Hemminger
2023-05-30 17:50       ` Pavan Nikhilesh Bhagavatula [this message]
2023-05-30  7:44     ` Ruifeng Wang
2023-05-31  4:26     ` [PATCH v4 " pbhagavatula
2023-05-31  4:26       ` [PATCH v4 2/2] test: add reassembly perf test pbhagavatula
2023-06-05 11:12         ` Константин Ананьев
2023-06-02 17:01       ` [PATCH v5 1/2] ip_frag: optimize key compare and hash generation pbhagavatula
2023-06-02 17:01         ` [PATCH v5 2/2] test: add reassembly perf test pbhagavatula
2023-06-27  9:36           ` Konstantin Ananyev
2023-06-05 11:09         ` [PATCH v5 1/2] ip_frag: optimize key compare and hash generation Константин Ананьев
2023-06-27  9:23         ` Konstantin Ananyev
2023-07-11 16:52         ` [PATCH v6 " pbhagavatula
2023-07-11 16:52           ` [PATCH v6 2/2] test: add reassembly perf test pbhagavatula
2023-07-12 14:59           ` [PATCH v6 1/2] ip_frag: optimize key compare and hash generation 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=PH0PR18MB4086844B608EEAF11945AD2ADE4B9@PH0PR18MB4086.namprd18.prod.outlook.com \
    --to=pbhagavatula@marvell.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=ruifeng.wang@arm.com \
    --cc=sameh.gobriel@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=vladimir.medvedkin@intel.com \
    --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).