public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Arjun Roy <arjunroy.kdev@gmail•com>
To: davem@davemloft•net, netdev@vger•kernel.org
Cc: arjunroy@google•com, soheil@google•com, edumazet@google•com,
	Arjun Roy <arjunroy.kdev@gmail•com>
Subject: [PATCH net-next] tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE.
Date: Thu, 12 Dec 2019 14:59:30 -0800	[thread overview]
Message-ID: <20191212225930.233745-1-arjunroy.kdev@gmail.com> (raw)

At present, if the last frag of paged data in a skb has < PAGE_SIZE
data, we compute the recv_skip_hint as being equal to the size of that
frag and the entire next skb.

Instead, just return the runt frag size as the hint.

Signed-off-by: Arjun Roy <arjunroy@google•com>
Acked-by: Soheil Hassas Yeganeh <soheil@google•com>
Signed-off-by: Eric Dumazet <edumazet@google•com>

---
 net/ipv4/tcp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 34490d972758..b9623d896469 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1904,6 +1904,8 @@ static int tcp_zerocopy_receive(struct sock *sk,
 	while (length + PAGE_SIZE <= zc->length) {
 		if (zc->recv_skip_hint < PAGE_SIZE) {
 			if (skb) {
+				if (zc->recv_skip_hint > 0)
+					break;
 				skb = skb->next;
 				offset = seq - TCP_SKB_CB(skb)->seq;
 			} else {
-- 
2.24.1.735.g03f4e72817-goog


             reply	other threads:[~2019-12-12 22:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 22:59 Arjun Roy [this message]
2019-12-15 19:22 ` [PATCH net-next] tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE Jakub Kicinski
2019-12-15 19:59   ` Eric Dumazet

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=20191212225930.233745-1-arjunroy.kdev@gmail.com \
    --to=arjunroy.kdev@gmail$(echo .)com \
    --cc=arjunroy@google$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=edumazet@google$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=soheil@google$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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