On Thu, Dec 10, 2015 at 1:51 AM, Per Hurtig <per.hur...@kau.se> wrote: > >> On 08 Dec 2015, at 14:47, Eric Dumazet <eric.duma...@gmail.com> wrote: >> >> On Tue, 2015-12-08 at 10:19 +0100, Per Hurtig wrote: >> >>> +static u32 tcp_unsent_pkts(const struct sock *sk, u32 ulimit) >>> +{ >>> + struct sk_buff *skb = tcp_send_head(sk); >>> + u32 pkts = 0; >>> + >>> + if (skb) >>> + tcp_for_write_queue_from(skb, sk) { >>> + pkts += tcp_skb_pcount(skb); >>> + >>> + if (ulimit && pkts >= ulimit) >>> + return ulimit; >>> + } >>> + >>> + return pkts; >>> +} >> >> >> Considering Yuchung feedback, have you looked at using an approximation >> instead ? >> >> (ie using tp->write_seq - tp->snd_nxt) >> >> > > Well, an approximation is rather “dangerous” as missing a single packet > could inhibit the desired behaviour. If looping is undesired, I think a > better solution is to actually *not* do this check at all and instead rely > solely on the > > tp->packets_out < TCP_RTORESTART_THRESH
Yes, this simpler version seems very much preferable, IMHO. I agree that it does not seem worth the complexity to try to cover the kind of corner cases you outline. I would also suggest a TCP_RTORESTART_THRESH value higher than 4. In the ID at https://tools.ietf.org/html/draft-ietf-tcpm-rtorestart-10 it says: The RECOMMENDED value of rrthresh is four, as this value will ensure that RTOR is only used when fast retransmit cannot be triggered. But my sense is that fast retransmit is often not triggered at in-flight counts of much higher than 4, due to drop-tail queues, TSO bursts, the initial IW10 being unpaced, etc. It would be interesting to see A/B experiments for a few TCP_RTORESTART_THRESH values, say, 4 vs 10. neal -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html