netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Yafang Shao <laoar.shao@gmail.com>,
	davem@davemloft.net, edumazet@google.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] tcp: introduce skb_rbtree_walk_safe() and use it in tcp_clean_rtx_queue()
Date: Wed, 28 Nov 2018 09:26:27 -0800	[thread overview]
Message-ID: <b8b7bbd2-8f7c-2aef-e9d0-343f8c4c2b2d@gmail.com> (raw)
In-Reply-To: <408125e7-bbb0-dcfb-ee19-58089802cac7@gmail.com>



On 11/28/2018 08:53 AM, Eric Dumazet wrote:
> 
> 
> On 11/28/2018 06:44 AM, Eric Dumazet wrote:
>>
> 
>> Because we can break of the loop if the current skb is not fully acked.
>>
>> So your patch would add unnecessary overhead, since the extra sk_rb_next()
>> could add more extra cache line misses.
> 
> I am testing the following optimization, since we can avoid the rb_next() call
> when we reached snd_una
> 
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index f32397890b6dcbc34976954c4be142108efa04d8..6829e470f0c186a73c34dca414cd4a2b379baded 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -3126,7 +3126,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, u32 prior_fack,
>                 if (!fully_acked)
>                         break;
>  
> -               next = skb_rb_next(skb);
> +               next = (scb->end_seq == tp->snd_una) ? NULL : skb_rb_next(skb);
> +
>                 if (unlikely(skb == tp->retransmit_skb_hint))
>                         tp->retransmit_skb_hint = NULL;
>                 if (unlikely(skb == tp->lost_skb_hint))
> 

This does not work since we use next skb after the loop :

1)   if (!skb)
          tcp_chrono_stop(sk, TCP_CHRONO_BUSY);

  This test could use tcp_rtx_queue_empty()

2) SACK reneging
    if (skb && (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
            flag |= FLAG_SACK_RENEGING;

3) FLAG_SET_XMIT_TIMER
     } else if (skb && rtt_update && sack_rtt_us >= 0 && 
                sack_rtt_us > tcp_stamp_us_delta(tp->tcp_mstamp,
                                                 tcp_skb_timestamp_us(skb))) {
                flag |= FLAG_SET_XMIT_TIMER;  /* set TLP or RTO timer */
 
So this idea is not feasible.

  reply	other threads:[~2018-11-28 17:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 12:16 [PATCH net-next] tcp: introduce skb_rbtree_walk_safe() and use it in tcp_clean_rtx_queue() Yafang Shao
2018-11-28 14:44 ` Eric Dumazet
2018-11-28 16:53   ` Eric Dumazet
2018-11-28 17:26     ` Eric Dumazet [this message]
2018-11-29  2:32   ` Yafang Shao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8b7bbd2-8f7c-2aef-e9d0-343f8c4c2b2d@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).