public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Frank Li <lznuaa@gmail.com>
Cc: Frank Li <Frank.Li@freescale.com>,
	shawn.guo@linaro.org, B38611@freescale.com, davem@davemloft.net,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	bhutchings@solarflare.com, s.hauer@pengutronix.de
Subject: Re: [PATCH 1/2 net-next] net: fec: add napi support to improve proformance
Date: Wed, 23 Jan 2013 05:49:14 -0800	[thread overview]
Message-ID: <1358948954.12374.758.camel@edumazet-glaptop> (raw)
In-Reply-To: <CAHrpEqTqSfBCpoMZ9S81VoXWgVK1iOR+e2OasARgbTD8m_RRvw@mail.gmail.com>

On Wed, 2013-01-23 at 15:37 +0800, Frank Li wrote:
> 2013/1/23 Eric Dumazet <eric.dumazet@gmail.com>:
> > On Wed, 2013-01-23 at 12:12 +0800, Frank Li wrote:
> >> Add napi support
> >>
> >> Before this patch
> >>
> >>  iperf -s -i 1
> >>  ------------------------------------------------------------
> >>  Server listening on TCP port 5001
> >>  TCP window size: 85.3 KByte (default)
> >>  ------------------------------------------------------------
> >>  [  4] local 10.192.242.153 port 5001 connected with 10.192.242.138 port 50004
> >>  [ ID] Interval       Transfer     Bandwidth
> >>  [  4]  0.0- 1.0 sec  41.2 MBytes   345 Mbits/sec
> >>  [  4]  1.0- 2.0 sec  43.7 MBytes   367 Mbits/sec
> >>  [  4]  2.0- 3.0 sec  42.8 MBytes   359 Mbits/sec
> >>  [  4]  3.0- 4.0 sec  43.7 MBytes   367 Mbits/sec
> >>  [  4]  4.0- 5.0 sec  42.7 MBytes   359 Mbits/sec
> >>  [  4]  5.0- 6.0 sec  43.8 MBytes   367 Mbits/sec
> >>  [  4]  6.0- 7.0 sec  43.0 MBytes   361 Mbits/sec
> >>
> >> After this patch
> >>  [  4]  2.0- 3.0 sec  51.6 MBytes   433 Mbits/sec
> >>  [  4]  3.0- 4.0 sec  51.8 MBytes   435 Mbits/sec
> >>  [  4]  4.0- 5.0 sec  52.2 MBytes   438 Mbits/sec
> >>  [  4]  5.0- 6.0 sec  52.1 MBytes   437 Mbits/sec
> >>  [  4]  6.0- 7.0 sec  52.1 MBytes   437 Mbits/sec
> >>  [  4]  7.0- 8.0 sec  52.3 MBytes   439 Mbits/sec
> >
> > Strange, as you still call netif_rx()
> >
> > NAPI should call netif_receive_skb() instead
> >
> 
> Thank you point out.
> After re-test, I found performance is almost no change if use netif_receive_skb.
> I am not sure if it is my NAPI implement problem.
> 
> napi_gro_received is better than netif_receive_skb, but worse than netif_rx.
> 
> From performance point view,
> 
> netif_rx                    --- fastest
> napi_gro_received   --- middle, near to netif_rx
> netif_receive_skb    --- slowest, almost the same as original no-napi version.
> 
> Do you have any idea about this phenomena?

No idea, you'll have to find out using perf tool if available.

Is your machine SMP, and the application running on another cpu than the
softirq handler for your device ?

A NAPI driver must call netif_receive_skb(), especially if
the RX path does a full copy of the frame : Its hot in cpu cache and
should be processed at once.

Escaping to netif_rx() is only adding an extra softirq and risk of data
being evicted from cpu caches.

Here your performance increase only comes from hw_lock being not anymore
locked in RX path.

  reply	other threads:[~2013-01-23 13:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23  4:12 [PATCH 1/2 net-next] net: fec: add napi support to improve proformance Frank Li
2013-01-23  6:21 ` Eric Dumazet
2013-01-23  7:37   ` Frank Li
2013-01-23 13:49     ` Eric Dumazet [this message]
2013-01-24  2:26       ` Frank Li
2013-01-24  6:39         ` Waskiewicz Jr, Peter P
2013-01-23  6:37 ` Waskiewicz Jr, Peter P
2013-01-23  7:56   ` Frank Li
2013-01-23  7:26 ` Sascha Hauer
2013-01-23  7:44   ` Frank Li
2013-01-23  7:52     ` David Miller
2013-01-23  7:53     ` Sascha Hauer
2013-01-23  8:00       ` Frank Li

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=1358948954.12374.758.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=B38611@freescale.com \
    --cc=Frank.Li@freescale.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lznuaa@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawn.guo@linaro.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