diff options
author | Soheil Hassas Yeganeh <soheil@google.com> | 2018-09-26 16:57:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-10-01 22:36:56 -0700 |
commit | 8f2b02931175ca56ddb1fe1a2393c34d97a25aa0 (patch) | |
tree | 5ce71db49075b5052e2d2d33efd67152e0589e90 /net/ipv4/tcp.c | |
parent | 2240c12d7d3de741ffbcf22d7a96358a450051ac (diff) | |
download | linux-8f2b02931175ca56ddb1fe1a2393c34d97a25aa0.tar.gz linux-8f2b02931175ca56ddb1fe1a2393c34d97a25aa0.tar.bz2 linux-8f2b02931175ca56ddb1fe1a2393c34d97a25aa0.zip |
tcp: set recv_skip_hint when tcp_inq is less than PAGE_SIZE
When we have less than PAGE_SIZE of data on receive queue,
we set recv_skip_hint to 0. Instead, set it to the actual
number of bytes available.
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index dcf51fbf5ec7..78ac4d2e3827 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1753,6 +1753,7 @@ static int tcp_zerocopy_receive(struct sock *sk, struct vm_area_struct *vma; struct sk_buff *skb = NULL; struct tcp_sock *tp; + int inq; int ret; if (address & (PAGE_SIZE - 1) || address != zc->address) @@ -1773,12 +1774,15 @@ static int tcp_zerocopy_receive(struct sock *sk, tp = tcp_sk(sk); seq = tp->copied_seq; - zc->length = min_t(u32, zc->length, tcp_inq(sk)); + inq = tcp_inq(sk); + zc->length = min_t(u32, zc->length, inq); zc->length &= ~(PAGE_SIZE - 1); - - zap_page_range(vma, address, zc->length); - - zc->recv_skip_hint = 0; + if (zc->length) { + zap_page_range(vma, address, zc->length); + zc->recv_skip_hint = 0; + } else { + zc->recv_skip_hint = inq; + } ret = 0; while (length + PAGE_SIZE <= zc->length) { if (zc->recv_skip_hint < PAGE_SIZE) { |