From: Stephen Hemminger <shemminger@vyatta.com>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [RFC] loopback: optimization
Date: Wed, 5 Nov 2008 16:42:51 -0800 [thread overview]
Message-ID: <20081105164251.2ca307fb@extreme> (raw)
In-Reply-To: <491228C8.3010100@cosmosbay.com>
On Thu, 06 Nov 2008 00:14:16 +0100
Eric Dumazet <dada1@cosmosbay.com> wrote:
> Stephen Hemminger a écrit :
> > Convert loopback device from using common network queues to a per-cpu
> > receive queue with NAPI. This gives a small 1% performance gain when
> > measured over 5 runs of tbench. Not sure if it's worth bothering
> > though.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> >
> > --- a/drivers/net/loopback.c 2008-11-04 15:36:29.000000000 -0800
> > +++ b/drivers/net/loopback.c 2008-11-05 10:00:20.000000000 -0800
> > @@ -59,7 +59,10 @@
> >
> > +/* Special case version of napi_schedule since loopback device has no hard irq */
> > +void napi_schedule_irq(struct napi_struct *n)
> > +{
> > + if (napi_schedule_prep(n)) {
> > + list_add_tail(&n->poll_list, &__get_cpu_var(softnet_data).poll_list);
> > + __raise_softirq_irqoff(NET_RX_SOFTIRQ);
> > + }
> > +}
> > +
>
> Stephen, I dont get it.
>
> Sure loopback device cannot generate hard irqs, but what prevent's a real hardware
> interrupt to call NIC driver that can call napi_schedule() and corrupt softnet_data.poll_list ?
>
> Why not using a queue dedicated on loopback directly in cpu_var(softnet_data) ?
>
> (ie not using a napi structure for each cpu and each loopback dev)
>
> This queue would be irq safe yes.
>
> net_rx_action could handle this list without local_irq_disable()/local_irq_enable() games.
>
> Hum, maybe complex for loopback_dev_stop() to purge all queues without interfering with other namespaces.
I did try a workqueue and kthread version previously, but they both had much worse
performance. Forgot that the NAPI schedule is shared, so yes that would have to locked.
Doing it purely for loopback would mean using a tasklet or another softirq.
prev parent reply other threads:[~2008-11-06 0:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-04 5:37 [RFC] loopback: optimization Stephen Hemminger
2008-11-04 6:36 ` Eric Dumazet
2008-11-05 9:49 ` David Miller
2008-11-05 20:36 ` Stephen Hemminger
2008-11-05 23:14 ` Eric Dumazet
2008-11-06 0:42 ` Stephen Hemminger [this message]
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=20081105164251.2ca307fb@extreme \
--to=shemminger@vyatta.com \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.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).