netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <therbert@google.com>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: Re: [PATCH v2] Receive Packet Steering
Date: Tue, 12 May 2009 10:28:33 -0700	[thread overview]
Message-ID: <65634d660905121028s18034ee3w6da360a450d3b117@mail.gmail.com> (raw)
In-Reply-To: <49FE7D63.6050102@cosmosbay.com>

On Sun, May 3, 2009 at 10:30 PM, Eric Dumazet <dada1@cosmosbay.com> wrote:
>
> Tom Herbert a écrit :
> > This is an update of the receive packet steering patch (RPS) based on received
> > comments (thanks for all the comments).  Improvements are:
> >
> > 1) Removed config option for the feature.
> > 2) Made scheduling of backlog NAPI devices between CPUs lockless and much
> > simpler.
> > 3) Added new softirq to do defer sending IPIs for coalescing.
> > 4) Imported hash from simple_rx_hash.  Eliminates modulo operation to convert
> > hash to index.
> > 5) If no cpu is found for packet steering, then netif_receive_skb processes
> > packet inline as before without queueing.  In paritcular if RPS is not
> > configured on a device the receive path is unchanged from current for
> > NAPI devices (one additional conditional).
> >
> > Tom
>
> Seems cool, but I found two errors this morning before my cofee ;)
>
> Is it a working patch or an RFC ?
>
Patch mostly works.  It's based on code from an earlier kernel that
we've been running for more than year.

> Its also not clear from ChangeLog how this is working, and even
> after reading your patch, its not yet very clear. Please provide
> more documentation, on every submission.
>
Okay.

> What about latencies ? I really do think that if cpu handling
> device is lightly loaded, it should handle packet itself, without
> giving it to another cpu, incurring many cache lines bounces.
>

While it's true that this scheme adds overhead for processing a single
packet at a time, we've found that by setting the per device CPU mask
to CPUs sharing the same L2/L3 cache we can reduce that overhead
substantially to the point that even for a small number of active
connections (around ten in out setup) the benefits of parallelizing
the path overcome the extra overhead resulting in lower average
latency.  So this would increase latency for doing a single ping, but
even for a moderate loaded server we see latency improvements.

> > +static int enqueue_to_backlog(struct sk_buff *skb, int cpu)
> > +{
> > +     struct softnet_data *queue;
> > +     unsigned long flags;
> > +
> > +     queue = &per_cpu(softnet_data, cpu);
> > +     spin_lock_irqsave(&queue->input_pkt_queue.lock, flags);
>
> I wonder... isnt it going to really hurt with cache line ping pongs ?
>

I suppose it is possible, although we haven't see this pop up in
profiling.  Coalescing packets before doing the IPI might be
alleviating that.


> > +             /* Schedule NAPI for backlog device */
> > +             if (napi_schedule_prep(&queue->backlog)) {
> > +                     if (cpu != smp_processor_id()) {
> > +                             cpu_set(cpu,
> > +                                 get_cpu_var(rps_remote_softirq_cpus));
>
> get_cpu_var() increases preempt_count (preempt_disable), where is the opposite decrease ?
>

Right, should be __get_cpu_var.

Tom

  parent reply	other threads:[~2009-05-12 17:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-04  4:03 [PATCH v2] Receive Packet Steering Tom Herbert
2009-05-04  5:30 ` Eric Dumazet
2009-05-04  6:10   ` Eric Dumazet
2009-05-04  7:13   ` Eric Dumazet
2009-05-12 17:28   ` Tom Herbert [this message]
2009-05-04  7:08 ` Eric Dumazet
2009-05-04  7:59 ` Andi Kleen
2009-05-04 18:22 ` Jarek Poplawski
2009-05-04 20:43   ` Jarek Poplawski
2009-06-10  8:23 ` David Miller
2009-06-15  5:54   ` Tom Herbert
     [not found]   ` <65634d660906142252y6f7fc021l844b172995c10044@mail.gmail.com>
2009-06-15  9:02     ` David Miller
2009-06-15 16:39       ` Tom Herbert
2009-06-15 23:18         ` David Miller
2009-07-13 17:49 ` David Miller
2009-07-13 22:04   ` Tom Herbert
2009-07-14 19:33     ` David Miller
2009-07-14 23:28       ` Tom Herbert
2009-07-17  2:48         ` David Miller
2009-07-17 18:05           ` Tom Herbert
2009-07-17 18:08             ` David Miller
2009-07-17 19:59               ` Tom Herbert
2009-07-18  3:54                 ` David Miller

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=65634d660905121028s18034ee3w6da360a450d3b117@mail.gmail.com \
    --to=therbert@google.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).