Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1034664imm; Tue, 5 Jun 2018 08:10:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJjJvs68s2gkha+8ppoKJzR8Pv3VKqvw7lhztYDzwcsvvZWdPAQcG85KgYQW4ZmN5OmC/E3 X-Received: by 2002:a17:902:b483:: with SMTP id y3-v6mr27016120plr.66.1528211400050; Tue, 05 Jun 2018 08:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528211400; cv=none; d=google.com; s=arc-20160816; b=FT7A488OjtiRrvEWokMW1zo87963kMdpj2e0ZqpjqnPBb29LfGX/kKZVLATL99xFXZ kUPZmq+xpWBfXLpDtfqAnXOJBOL7ky6wFltTgD1axn22V06afIynGz19lzzQN56VEo6/ Cs4/1SlsvAVEZ0iNRQ5xaBWke8Gn+eTgmCpSJCCFj1m9GQOPXF9RDE8i1rJpve0n3lw8 RU0vlTH541bh/2octSde4WOIQYyIjsrN9i14s/Vsa7cNDlZJWl1UMTBQM0pBil0fxaUR zQEOCsbCkft89wAhhtfwhS+6yk1sZ8UuJ9beepyxmzM3PSJSrySSYaptJcGl+iV5JtKR L25w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :arc-authentication-results; bh=ifqK4+F2RhKOBFx6BKYuQXOHpWF87WBXFNIqJIkToJs=; b=iRgBR4pm5gRH5dqeVqdiMugLvP0jPsGtlDB0HH8FUS4c22YjtiddMAaOEjeoXUy8C+ x/yIumTDYzsEpUdBSGnp/DxsjIrwiORUlVLL6vNSnxDsgqmMhCMcg69FbolUEE5sgBD0 0Dz2/oosjDYiN0Gf66XdwWmJiBBNkAADR5bmUL6vXrMszS9867Ad9QFW5SYyGV+OplgL GAl0RxmjeQFmEd7VbxMjKMe/ta1yjGhaTiI9sgvEFq/HSq6deCw52ZRXnuM+WkdGzvg/ bmlr2/8G49KAw43ZcG6uxOfUtNbsAb9vspuIHe5bnRb+4QwP48EPHhd/Cp4Fnbopuvvf 4c1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9-v6si9157158pll.64.2018.06.05.08.09.45; Tue, 05 Jun 2018 08:10:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751908AbeFEPI6 (ORCPT + 99 others); Tue, 5 Jun 2018 11:08:58 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:37448 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751870AbeFEPI5 (ORCPT ); Tue, 5 Jun 2018 11:08:57 -0400 Received: from localhost (unknown [66.187.232.66]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id DE42B133FB1D7; Tue, 5 Jun 2018 08:08:55 -0700 (PDT) Date: Tue, 05 Jun 2018 11:08:54 -0400 (EDT) Message-Id: <20180605.110854.1668470026592587341.davem@davemloft.net> To: laoar.shao@gmail.com Cc: pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 1/2] ipv4: replace ip_hdr() with skb->data for optimization From: David Miller In-Reply-To: References: <1528200262-11834-1-git-send-email-laoar.shao@gmail.com> <9ce783dc628699f02c45650c942f6735e93a18c4.camel@redhat.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 05 Jun 2018 08:08:56 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yafang Shao Date: Tue, 5 Jun 2018 20:29:05 +0800 > On Tue, Jun 5, 2018 at 8:20 PM, Paolo Abeni wrote: >> On Tue, 2018-06-05 at 08:04 -0400, Yafang Shao wrote: >>> In ip receive path, when ip header hasn't been pulled yet, ip_hdr() and >>> skb->data are pointing to the same byte. >>> >>> In ip output path, when ip header is just pushed, ip_hdr() and skb->data >>> are pointing to the same byte. >>> >>> As ip_hdr() is more expensive than using skb->data, so replace ip_hdr() >>> with skb->data in these situations for optimization. >> >> IMHO this makes the code less readable and more error prone. Which kind >> of performance improvement do you measure here? >> > > Correct the cc list. > > Hi Paolo, > > There's a "+" opertaion in ip_hdr(), using skb->data and avoid this operation. Paolo is asking what performance improvement did you "measure". I don't think this can possibly show up in a benchmark at all, and I agree the code becomes less readable, so I am not applying this, sorry.