All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE.
@ 2019-12-12 22:59 Arjun Roy
  2019-12-15 19:22 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Arjun Roy @ 2019-12-12 22:59 UTC (permalink / raw)
  To: davem, netdev; +Cc: arjunroy, soheil, edumazet, Arjun Roy

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.

Signed-off-by: Arjun Roy <arjunroy@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>

---
 net/ipv4/tcp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 34490d972758..b9623d896469 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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 {
-- 
2.24.1.735.g03f4e72817-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE.
  2019-12-12 22:59 [PATCH net-next] tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE Arjun Roy
@ 2019-12-15 19:22 ` Jakub Kicinski
  2019-12-15 19:59   ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2019-12-15 19:22 UTC (permalink / raw)
  To: Arjun Roy; +Cc: davem, netdev, arjunroy, soheil, edumazet

On Thu, 12 Dec 2019 14:59:30 -0800, Arjun Roy wrote:
> 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.

nit: this commit message doesn't really tell us why or what the effects
     are going to be.

> Signed-off-by: Arjun Roy <arjunroy@google.com>
> Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

WARNING: Missing Signed-off-by: line by nominal patch author 'Arjun Roy <arjunroy.kdev@gmail.com>'

You gotta send it from the same address you signed it off from.
 
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 34490d972758..b9623d896469 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -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 {


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE.
  2019-12-15 19:22 ` Jakub Kicinski
@ 2019-12-15 19:59   ` Eric Dumazet
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2019-12-15 19:59 UTC (permalink / raw)
  To: Jakub Kicinski, Arjun Roy; +Cc: davem, netdev, arjunroy, soheil, edumazet



On 12/15/19 11:22 AM, Jakub Kicinski wrote:
> On Thu, 12 Dec 2019 14:59:30 -0800, Arjun Roy wrote:
>> 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.
> 
> 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

> 
>> Signed-off-by: Arjun Roy <arjunroy@google.com>
>> Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
> 
> WARNING: Missing Signed-off-by: line by nominal patch author 'Arjun Roy <arjunroy.kdev@gmail.com>'
> 
> You gotta send it from the same address you signed it off from.

I sent a v2 on behalf of Arjun.

Thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-15 19:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12 22:59 [PATCH net-next] tcp: Set rcv zerocopy hint correctly if skb last frag is < PAGE_SIZE Arjun Roy
2019-12-15 19:22 ` Jakub Kicinski
2019-12-15 19:59   ` Eric Dumazet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.