From mboxrd@z Thu Jan 1 00:00:00 1970 From: Changli Gao Subject: Re: [PATCH v2] rps: optimize rps_get_cpu() Date: Thu, 22 Apr 2010 14:10:20 +0800 Message-ID: References: <1271772160-28177-1-git-send-email-xiaosuo@gmail.com> <20100421.224014.77255834.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: therbert@google.com, eric.dumazet@gmail.com, netdev@vger.kernel.org To: David Miller Return-path: Received: from mail-iw0-f178.google.com ([209.85.223.178]:36014 "EHLO mail-iw0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751034Ab0DVGKl convert rfc822-to-8bit (ORCPT ); Thu, 22 Apr 2010 02:10:41 -0400 Received: by iwn8 with SMTP id 8so1674537iwn.16 for ; Wed, 21 Apr 2010 23:10:41 -0700 (PDT) In-Reply-To: <20100421.224014.77255834.davem@davemloft.net> Sender: netdev-owner@vger.kernel.org List-ID: On Thu, Apr 22, 2010 at 1:40 PM, David Miller wro= te: > > I'll buy you a cookie if you can find a multiply generated by the > compiler for "x * 4". =C2=A0It'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 27a3: 85 c0 test %eax,%eax 27a5: 74 28 je 27cf __be16 *hports =3D (__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. =C2=A0It would have helped yo= u > here. =C2=A0I was willing to apply the port dereference part of your > change, but not necessarily the 'ihl' changes. =C2=A0But 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. --=20 Regards=EF=BC=8C Changli Gao(xiaosuo@gmail.com)