All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Tom Herbert <therbert@google.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: Re: [PATCH] Software receive packet steering
Date: Tue, 21 Apr 2009 11:48:43 +0200	[thread overview]
Message-ID: <49ED967B.4070105@cosmosbay.com> (raw)
In-Reply-To: <65634d660904202026r7d73f810s700bacb8756e0967@mail.gmail.com>

Tom Herbert a écrit :
> On Mon, Apr 20, 2009 at 3:32 AM, Andi Kleen <andi@firstfloor.org> wrote:
>> Tom Herbert <therbert@google.com> writes:
>>
>>> +static int netif_cpu_for_rps(struct net_device *dev, struct sk_buff *skb)
>>> +{
>>> +     cpumask_t mask;
>>> +     unsigned int hash;
>>> +     int cpu, count = 0;
>>> +
>>> +     cpus_and(mask, dev->soft_rps_cpus, cpu_online_map);
>>> +     if (cpus_empty(mask))
>>> +             return smp_processor_id();
>> There's a race here with CPU hotunplug I think. When a CPU is hotunplugged
>> in parallel you can still push packets to it even though they are not
>> drained. You probably need some kind of drain callback in a CPU hotunplug
>> notifier that eats all packets left over.
>>
> We will look at that, the hotplug support may very well be lacking in the patch.
> 
>>> +got_hash:
>>> +     hash %= cpus_weight_nr(mask);
>> That looks rather heavyweight even on modern CPUs. I bet it's 40-50+ cycles
>> alone forth the hweight and the division. Surely that can be done better?
>>
> Agreed, I will try to pull in the RX hash from Dave Miller's remote
> softirq patch.
> 
>> Also I suspect some kind of runtime switch for this would be useful.
>>
>> Also the manual set up of the receive mask seems really clumpsy. Couldn't
>> you set that up dynamically based on where processes executing recvmsg()
>> are running?
>>
> We have done exactly that.  It works very well in many cases
> (application + platform combinations), but I haven't found it to be
> better than doing the hash in all cases.  I could provide the patch,
> but it might be more of a follow patch to this base one.

Hello Tom

I was thinking about your patch (and David's one), and thought it could be
possible to spread packets to other cpus only if current one is under stress.

A posssible metric would be to test if softirq is handled by ksoftirqd
(stress situation) or not.

Under moderate load, we could have one active cpu (and fewer cache line
transferts), keeping good latencies.

I tried alternative approach to solve the Multicast problem raised some time ago,
but still have one cpu handling one device. Only wakeups were defered to a
workqueue (and possibly another cpu) if running from ksoftirq only.
Patch not yet ready for review, but based on a previous patch that was more
intrusive (touching kernel/softirq.c)

Under stress, your idea permits to use more cpus for a fast NIC and get better
throughput. Its more generic.



  reply	other threads:[~2009-04-21  9:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 22:48 [PATCH] Software receive packet steering Tom Herbert
2009-04-08 23:08 ` Stephen Hemminger
2009-04-08 23:09 ` Stephen Hemminger
2009-04-08 23:15   ` David Miller
2009-04-09 16:43     ` Tom Herbert
2009-04-09 18:23       ` Ben Hutchings
2009-04-09 21:17       ` David Miller
2009-04-09  0:36 ` David Miller
2009-04-09  4:40   ` Tom Herbert
2009-04-09  5:24     ` David Miller
2009-04-20 10:32 ` Andi Kleen
2009-04-20 10:46   ` David Miller
2009-04-21  3:26   ` Tom Herbert
2009-04-21  9:48     ` Eric Dumazet [this message]
2009-04-21 15:46       ` Stephen Hemminger
2009-04-21 18:52         ` Tom Herbert
2009-04-22  9:21           ` David Miller
2009-04-22 15:46             ` Tom Herbert
2009-04-22 18:49             ` Rick Jones
2009-04-22 20:44             ` Jesper Dangaard Brouer
2009-04-23  6:58               ` Jens Axboe
2009-04-23  7:25                 ` David Miller
2009-04-23  7:29                   ` Jens Axboe
2009-04-23  9:12               ` Jens Laas
2009-04-22 14:33         ` Martin Josefsson
2009-04-23  7:34           ` 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=49ED967B.4070105@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=andi@firstfloor.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.