lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 17 Jul 2017 16:24:32 +0800
From:   lin zhang <xiaolou4617@...il.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next resubmit] skbuff: optimize the pull_pages code in __pskb_pull_tail()

2017-07-17 15:32 GMT+08:00 Eric Dumazet <eric.dumazet@...il.com>:
> On Mon, 2017-07-17 at 10:22 +0800, Lin Zhang wrote:
>> In the pull_pages code block, if the first frag size > eat,
>> we can end the loop in advance to avoid extra copy.
>>
>> Signed-off-by: Lin Zhang <xiaolou4617@...il.com>
>> ---
>>  net/core/skbuff.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
>> index f990eb8..c00a1df 100644
>> --- a/net/core/skbuff.c
>> +++ b/net/core/skbuff.c
>> @@ -1720,6 +1720,10 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta)
>>                               skb_shinfo(skb)->frags[k].page_offset += eat;
>>                               skb_frag_size_sub(&skb_shinfo(skb)->frags[k], eat);
>>                               eat = 0;
>> +                             if (!i) {
>> +                                     k = skb_shinfo(skb)->nr_frags;
>> +                                     break;
>> +                             }
>>                       }
>>                       k++;
>>               }
>
> -CC lkml  (no need to spam lkml for netdev patches )
>
> Why even reading skb_shinfo(skb)->nr_frags to write it again ?
>
> I would use something like :
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 8b11341ed69ad97d34dd3e9b73c8c44ef7c452ff..a562b0e61afa3faf7abdd7f9209ae9096310fb7d 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1719,13 +1719,15 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta)
>                         if (eat) {
>                                 skb_shinfo(skb)->frags[k].page_offset += eat;
>                                 skb_frag_size_sub(&skb_shinfo(skb)->frags[k], eat);
> +                               if (!i)
> +                                       goto end;
>                                 eat = 0;
>                         }
>                         k++;
>                 }
>         }
>         skb_shinfo(skb)->nr_frags = k;
> -
> +end:
>         skb->tail     += delta;
>         skb->data_len -= delta;
>
>
>
>
>
Yes, this change it is looks like better than me. :)


-- 
Lin Zhang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ