Skip to content

Commit 0e62719

Browse files
arjunroyJakub Kicinski
authored andcommitted
tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE
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. recv_skip_hint is used by the application to skip over bytes that can not be mmaped, so returning a too big chunk is pessimistic and forces more bytes to be copied. Signed-off-by: Arjun Roy <[email protected]> Acked-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 29115ce commit 0e62719

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv4/tcp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,8 @@ static int tcp_zerocopy_receive(struct sock *sk,
17781778
while (length + PAGE_SIZE <= zc->length) {
17791779
if (zc->recv_skip_hint < PAGE_SIZE) {
17801780
if (skb) {
1781+
if (zc->recv_skip_hint > 0)
1782+
break;
17811783
skb = skb->next;
17821784
offset = seq - TCP_SKB_CB(skb)->seq;
17831785
} else {

0 commit comments

Comments
 (0)