mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next] skbuff: optimize the pull_pages code in __pskb_pull_tail()
@ 2017-07-06  9:01 Lin Zhang
  2017-07-06  9:16 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Lin Zhang @ 2017-07-06  9:01 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel, netdev, Lin Zhang

In the pull_pages code block, if the first frags size > eat,
we can end the loop in advance to avoid extra copy.

Signed-off-by: Lin Zhang <xiaolou4617@gmail.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++;
 		}
-- 
1.8.3.1

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

* Re: [PATCH net-next] skbuff: optimize the pull_pages code in __pskb_pull_tail()
  2017-07-06  9:01 [PATCH net-next] skbuff: optimize the pull_pages code in __pskb_pull_tail() Lin Zhang
@ 2017-07-06  9:16 ` Eric Dumazet
  2017-07-06  9:23   ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2017-07-06  9:16 UTC (permalink / raw)
  To: Lin Zhang; +Cc: davem, linux-kernel, netdev

On Thu, 2017-07-06 at 17:01 +0800, Lin Zhang wrote:
> In the pull_pages code block, if the first frags size > eat,
> we can end the loop in advance to avoid extra copy.
> 
> Signed-off-by: Lin Zhang <xiaolou4617@gmail.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++;
>  		}

1) net-next is closed during merge window.

2) This change is completely buggy.
   How have you tested it exactly ???

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

* Re: [PATCH net-next] skbuff: optimize the pull_pages code in __pskb_pull_tail()
  2017-07-06  9:16 ` Eric Dumazet
@ 2017-07-06  9:23   ` Eric Dumazet
  2017-07-06  9:35     ` lin zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2017-07-06  9:23 UTC (permalink / raw)
  To: Lin Zhang; +Cc: davem, linux-kernel, netdev

On Thu, 2017-07-06 at 02:16 -0700, Eric Dumazet wrote:
> On Thu, 2017-07-06 at 17:01 +0800, Lin Zhang wrote:
> > In the pull_pages code block, if the first frags size > eat,
> > we can end the loop in advance to avoid extra copy.
> > 
> > Signed-off-by: Lin Zhang <xiaolou4617@gmail.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++;
> >  		}
> 
> 1) net-next is closed during merge window.
> 
> 2) This change is completely buggy.
>    How have you tested it exactly ???

Hmm... it looks like I was wrong, but 1) still applies ;)

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

* Re: [PATCH net-next] skbuff: optimize the pull_pages code in __pskb_pull_tail()
  2017-07-06  9:23   ` Eric Dumazet
@ 2017-07-06  9:35     ` lin zhang
  2017-07-06  9:48       ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: lin zhang @ 2017-07-06  9:35 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, linux-kernel, netdev

2017-07-06 17:23 GMT+08:00 Eric Dumazet <eric.dumazet@gmail.com>:
> On Thu, 2017-07-06 at 02:16 -0700, Eric Dumazet wrote:
>> On Thu, 2017-07-06 at 17:01 +0800, Lin Zhang wrote:
>> > In the pull_pages code block, if the first frags size > eat,
>> > we can end the loop in advance to avoid extra copy.
>> >
>> > Signed-off-by: Lin Zhang <xiaolou4617@gmail.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++;
>> >             }
>>
>> 1) net-next is closed during merge window.
>>
>> 2) This change is completely buggy.
>>    How have you tested it exactly ???
>
> Hmm... it looks like I was wrong, but 1) still applies ;)
>
>
>
>
thanks, i am a newer, "net-next is closed" it means i need repost it
after net-next reopened?

regards
-- 
Lin Zhang

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

* Re: [PATCH net-next] skbuff: optimize the pull_pages code in __pskb_pull_tail()
  2017-07-06  9:35     ` lin zhang
@ 2017-07-06  9:48       ` Eric Dumazet
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2017-07-06  9:48 UTC (permalink / raw)
  To: lin zhang; +Cc: David Miller, linux-kernel, netdev

On Thu, 2017-07-06 at 17:35 +0800, lin zhang wrote:

> thanks, i am a newer, "net-next is closed" it means i need repost it
> after net-next reopened?

Yes, please read Documentation/networking/netdev-FAQ.txt for details.

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

end of thread, other threads:[~2017-07-06  9:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-06  9:01 [PATCH net-next] skbuff: optimize the pull_pages code in __pskb_pull_tail() Lin Zhang
2017-07-06  9:16 ` Eric Dumazet
2017-07-06  9:23   ` Eric Dumazet
2017-07-06  9:35     ` lin zhang
2017-07-06  9:48       ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®