From: linzhang Date: Mon, 17 Jul 2017 09:25:02 +0000 (+0800) Subject: skbuff: optimize the pull_pages code in __pskb_pull_tail() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3ccc6c6faaa93da70989177b91c7c3ef0df10937;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- 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;