From: Changli Gao <xiaosuo@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: therbert@google.com, eric.dumazet@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH v2] rps: optimize rps_get_cpu()
Date: Thu, 22 Apr 2010 14:10:20 +0800 [thread overview]
Message-ID: <u2y412e6f7f1004212310sccf41ffaia264890402b8be3a@mail.gmail.com> (raw)
In-Reply-To: <20100421.224014.77255834.davem@davemloft.net>
On Thu, Apr 22, 2010 at 1:40 PM, David Miller <davem@davemloft.net> wrote:
>
> I'll buy you a cookie if you can find a multiply generated by the
> compiler for "x * 4". It's going to use shifts and those are
> basically free.
On amd64:
if (pskb_may_pull(skb, (ihl * 4) + 4)) {
2794: 8d 34 9d 04 00 00 00 lea 0x4(,%rbx,4),%esi
279b: 4c 89 ef mov %r13,%rdi
279e: e8 a5 fd ff ff callq 2548 <pskb_may_pull>
27a3: 85 c0 test %eax,%eax
27a5: 74 28 je 27cf <get_rps_cpu+0x169>
__be16 *hports = (__be16 *) (skb->data + (ihl * 4));
27a7: 8d 04 9d 00 00 00 00 lea 0x0(,%rbx,4),%eax
the compiler uses lea instead of multiply, and it should be more
efficient, but i'm not sure. Is there a equivalent of lea on the other
architectures?
>
> Please just change one thing at a time. It would have helped you
> here. I was willing to apply the port dereference part of your
> change, but not necessarily the 'ihl' changes. But because you've
> combined them, I have no choice but to reject everything.
>
Ok. I think the first version is ready to apply, it only has the port
dereference part.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
prev parent reply other threads:[~2010-04-22 6:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-20 14:02 [PATCH v2] rps: optimize rps_get_cpu() Changli Gao
2010-04-22 5:40 ` David Miller
2010-04-22 6:10 ` Changli Gao [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=u2y412e6f7f1004212310sccf41ffaia264890402b8be3a@mail.gmail.com \
--to=xiaosuo@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--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 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).