* [PATCH net-next resubmit] skbuff: optimize the pull_pages code in __pskb_pull_tail()
@ 2017-07-17 2:22 Lin Zhang
0 siblings, 0 replies; only message in thread
From: Lin Zhang @ 2017-07-17 2:22 UTC (permalink / raw)
To: davem; +Cc: linux-kernel, netdev, Lin Zhang
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>
---
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 related [flat|nested] only message in thread
only message in thread, other threads:[~2017-07-17 2:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 2:22 [PATCH net-next resubmit] skbuff: optimize the pull_pages code in __pskb_pull_tail() Lin Zhang
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).