From: Soheil Hassas Yeganeh <soheil.kdev@gmail•com>
To: davem@davemloft•net, netdev@vger•kernel.org
Cc: edumazet@google•com, Soheil Hassas Yeganeh <soheil@google•com>
Subject: [PATCH net-next 2/2] tcp: adjust rcv zerocopy hints based on frag sizes
Date: Wed, 26 Sep 2018 16:57:04 -0400 [thread overview]
Message-ID: <20180926205704.42754-2-soheil.kdev@gmail.com> (raw)
In-Reply-To: <20180926205704.42754-1-soheil.kdev@gmail.com>
From: Soheil Hassas Yeganeh <soheil@google•com>
When SKBs are coalesced, we can have SKBs with different
frag sizes. Some with PAGE_SIZE and some not with PAGE_SIZE.
Since recv_skip_hint is always set to the full SKB size,
it can overestimate the amount that should be read using
normal read for coalesced packets.
Change the recv_skip_hint so that it only includes the first
frags that are not of PAGE_SIZE.
Signed-off-by: Soheil Hassas Yeganeh <soheil@google•com>
Signed-off-by: Eric Dumazet <edumazet@google•com>
---
net/ipv4/tcp.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 3e17501fc1a1..cdbd423bdeb4 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1805,8 +1805,17 @@ static int tcp_zerocopy_receive(struct sock *sk,
frags++;
}
}
- if (frags->size != PAGE_SIZE || frags->page_offset)
+ if (frags->size != PAGE_SIZE || frags->page_offset) {
+ int remaining = zc->recv_skip_hint;
+
+ while (remaining && (frags->size != PAGE_SIZE ||
+ frags->page_offset)) {
+ remaining -= frags->size;
+ frags++;
+ }
+ zc->recv_skip_hint -= remaining;
break;
+ }
ret = vm_insert_page(vma, address + length,
skb_frag_page(frags));
if (ret)
--
2.19.0.605.g01d371f741-goog
next prev parent reply other threads:[~2018-09-27 3:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-26 20:57 [PATCH net-next 1/2] tcp: set recv_skip_hint when tcp_inq is less than PAGE_SIZE Soheil Hassas Yeganeh
2018-09-26 20:57 ` Soheil Hassas Yeganeh [this message]
2018-10-02 5:37 ` [PATCH net-next 2/2] tcp: adjust rcv zerocopy hints based on frag sizes David Miller
2018-10-02 5:37 ` [PATCH net-next 1/2] tcp: set recv_skip_hint when tcp_inq is less than PAGE_SIZE David Miller
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=20180926205704.42754-2-soheil.kdev@gmail.com \
--to=soheil.kdev@gmail$(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