diff options
author | linzhang <xiaolou4617@gmail.com> | 2017-07-17 11:25:02 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-17 17:56:50 +0200 |
commit | 3ccc6c6faaa93da70989177b91c7c3ef0df10937 (patch) | |
tree | 4fcc27c0a605eae9a6a8740d5933c6030fc9837a /net | |
parent | dt-bindings: net: ravb : Add support for r8a7743 SoC (diff) | |
download | linux-3ccc6c6faaa93da70989177b91c7c3ef0df10937.tar.xz linux-3ccc6c6faaa93da70989177b91c7c3ef0df10937.zip |
skbuff: optimize the pull_pages code in __pskb_pull_tail()
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@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/skbuff.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 8b11341ed69a..b352c6bcfb31 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -1719,6 +1719,8 @@ pull_pages: 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++; @@ -1726,6 +1728,7 @@ pull_pages: } skb_shinfo(skb)->nr_frags = k; +end: skb->tail += delta; skb->data_len -= delta; |