From: zhou rui <zhourui.cn@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: RPS will assign different smp_processor_id for the same packet?
Date: Sat, 23 Apr 2011 23:31:37 +0800 [thread overview]
Message-ID: <BANLkTikY6CAZNkcnU-i7UvPpmSfQuXKtNQ@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=gTNwKX1Tb3mqgWJekRf7n_MHpJQ@mail.gmail.com>
one more question is:
in the function "int netif_receive_skb(struct sk_buff *skb)"
cpu = get_rps_cpu(skb->dev, skb, &rflow);
if (cpu >= 0) {
ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail);
....
probably the cpu is different from the current processor id?(smp_processor_id)
let's say: get_rps_cpu->cpu 0, smp_processor_id->cpu1
when this happen, does it mean that cpu1 is handling the softirq but
have to divert the packet to cpu0?(via a new softirq?)
so for one packet it involve 2 softirqs?
possible to get_rps_cpu in interrupt,then let the target cpu do only
one softirq to hanle the packet?
thanks
On Fri, Apr 22, 2011 at 12:29 AM, zhou rui <zhourui.cn@gmail.com> wrote:
> On Friday, April 22, 2011, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> Le jeudi 21 avril 2011 à 18:08 +0200, Eric Dumazet a écrit :
>>> Le jeudi 21 avril 2011 à 23:50 +0800, zhou rui a écrit :
>>> > kernel 2.6.36.4
>>> > CONFIG_RPS=y but not set the cpu mask
>>> >
>>> > /sys/class/net/eth1/queues/rx-0 # cat rps_cpus
>>> > 00
>>> >
>>> > register a hook func:
>>> > prot_hook.func = packet_rcv;
>>> > prot_hook.type = htons(ETH_P_ALL);
>>> > dev_add_pack(&prot_hook);
>>> >
>>> >
>>> > replay the same traffic in very slow speed, printk the
>>> > smp_processor_id in packet_rcv():
>>> > first time:
>>> > cpu=4
>>> > cpu=3
>>> > cpu=6
>>> > cpu=7
>>> >
>>> > second time:
>>> > cpu=7
>>> > cpu=1
>>> > cpu=5
>>> > cpu=2
>>> >
>>> > is it normal?
>>>
>>> Yes it is.
>>>
>>> What would you expect ?
>>>
>>
>> If rps_cpus contains only '0' bits, it basically means RPS is not active
>> for this input queue.
>>
>> CPU is therefore not changed : The cpu handling NAPI on your network
>> device directly calls upper linux stack.
>>
>> Seeing your traces, it also means your device spreads its interrupts on
>> many different cpus, this might be not optimal.
>>
>> Check /proc/irq/{irq_number}/smp_affinity, it probably contains "ff"
>>
>>
>>
>>
> Thanks,just saw this email
>
next prev parent reply other threads:[~2011-04-23 15:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-21 15:50 RPS will assign different smp_processor_id for the same packet? zhou rui
2011-04-21 16:08 ` Eric Dumazet
2011-04-21 16:25 ` Eric Dumazet
2011-04-21 16:29 ` zhou rui
2011-04-23 15:31 ` zhou rui [this message]
2011-04-23 19:56 ` Tom Herbert
2011-04-24 2:00 ` zhou rui
2011-04-24 8:00 ` Eric Dumazet
2011-04-24 9:36 ` zhou rui
2011-04-24 10:53 ` Eric Dumazet
2011-04-25 11:02 ` Neil Horman
2011-04-21 16:27 ` zhou rui
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=BANLkTikY6CAZNkcnU-i7UvPpmSfQuXKtNQ@mail.gmail.com \
--to=zhourui.cn@gmail.com \
--cc=eric.dumazet@gmail.com \
--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).