linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH net-next 1/2] ipv4: replace ip_hdr() with skb->data for optimization
       [not found] ` <9ce783dc628699f02c45650c942f6735e93a18c4.camel@redhat.com>
@ 2018-06-05 12:29   ` Yafang Shao
  2018-06-05 15:08     ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Yafang Shao @ 2018-06-05 12:29 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: Eric Dumazet, David Miller, netdev, LKML

On Tue, Jun 5, 2018 at 8:20 PM, Paolo Abeni <pabeni@redhat.com> 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.

Thanks
Yafang

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next 1/2] ipv4: replace ip_hdr() with skb->data for optimization
  2018-06-05 12:29   ` [PATCH net-next 1/2] ipv4: replace ip_hdr() with skb->data for optimization Yafang Shao
@ 2018-06-05 15:08     ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-06-05 15:08 UTC (permalink / raw)
  To: laoar.shao; +Cc: pabeni, edumazet, netdev, linux-kernel

From: Yafang Shao <laoar.shao@gmail.com>
Date: Tue, 5 Jun 2018 20:29:05 +0800

> On Tue, Jun 5, 2018 at 8:20 PM, Paolo Abeni <pabeni@redhat.com> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-05 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1528200262-11834-1-git-send-email-laoar.shao@gmail.com>
     [not found] ` <9ce783dc628699f02c45650c942f6735e93a18c4.camel@redhat.com>
2018-06-05 12:29   ` [PATCH net-next 1/2] ipv4: replace ip_hdr() with skb->data for optimization Yafang Shao
2018-06-05 15:08     ` David Miller

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).