tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE.
Subsystems (3)
PATCH 1/1 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.
--- net/ipv4/tcp.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/tcp.c +2 -0
@@ -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 {
Signature · 1 line
2.24.1.735.g03f4e72817-goog
Quoted 5 lines · Arjun Roy
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.
nit: this commit message doesn't really tell us why or what the effects
are going to be.
Quoted 3 lines
Signed-off-by Arjun Roy <[email protected]>Signed-off-by Eric Dumazet <[email protected]>
WARNING: Missing Signed-off-by: line by nominal patch author 'Arjun Roy <[email protected]>'
You gotta send it from the same address you signed it off from.
Quoted 13 lines
net/ipv4/tcp.c +2
-0@@ -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 {
Quoted 9 lines · Jakub Kicinski
Quoted 5 lines · Arjun Roy
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.
nit: this commit message doesn't really tell us why or what the effects
are going to be.
Right, I added a bit of explanation.
Basically we would hint the application to copy more bytes than needed.
Since zerocopy is best effort, this can target net-next
Quoted 8 lines
Quoted 4 lines
Signed-off-by Arjun Roy <[email protected]>Signed-off-by Eric Dumazet <[email protected]>WARNING: Missing Signed-off-by: line by nominal patch author 'Arjun Roy <[email protected]>'
You gotta send it from the same address you signed it off from.
I sent a v2 on behalf of Arjun.
Thanks.