tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE
Subsystems (3)
PATCH v2 1/1 tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE
From: Arjun Roy <[email protected]>
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.
---
v2: added more info in the changelog (Jakub)
net/ipv4/tcp.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/tcp.c +2 -0
@@ -1778,6 +1778,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 {
Signature · 1 line
2.24.1.735.g03f4e72817-goog
Jakub Kicinski
AppliedQuoted 8 lines · Eric Dumazet
From: Arjun Roy <[email protected]>
At present, if the last frag of paged data in a skb has <
PAGE_SIZEdata, we compute therecv_skip_hintas being equal to the size of that frag and the entire next skb.Instead, just return the runt frag size as the hint.
Quoted 7 lines
recv_skip_hintis 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]>Signed-off-by Eric Dumazet <[email protected]>
Applied, thank you!!