From: Lin Zhang <xiaolou4617@gmail.com>
To: davem@davemloft.net
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Lin Zhang <xiaolou4617@gmail.com>
Subject: [PATCH net-next resubmit] skbuff: optimize the pull_pages code in __pskb_pull_tail()
Date: Mon, 17 Jul 2017 10:22:06 +0800 [thread overview]
Message-ID: <1500258126-11235-1-git-send-email-xiaolou4617@gmail.com> (raw)
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
reply other threads:[~2017-07-17 2:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1500258126-11235-1-git-send-email-xiaolou4617@gmail.com \
--to=xiaolou4617@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®