summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2017-10-06 07:21:24 +0200
committerDavid S. Miller <davem@davemloft.net>2017-10-07 01:28:53 +0200
commit5e76ee4b8e90384936a214cde5b7816424f70232 (patch)
tree24d8072eb5d33600fd67ab24ffa4f3706ee390d8
parenttcp: tcp_tx_timestamp() cleanup (diff)
downloadlinux-5e76ee4b8e90384936a214cde5b7816424f70232.tar.xz
linux-5e76ee4b8e90384936a214cde5b7816424f70232.zip
tcp: tcp_mark_head_lost() optimization
It will be a bit more expensive to get the head of rtx queue once rtx queue is converted to an rb-tree. We can avoid this extra cost in case tp->lost_skb_hint is set. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/tcp_input.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 90afe4143596..abc3b1db81f8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2207,12 +2207,12 @@ static void tcp_mark_head_lost(struct sock *sk, int packets, int mark_head)
const u32 loss_high = tcp_is_sack(tp) ? tp->snd_nxt : tp->high_seq;
WARN_ON(packets > tp->packets_out);
- if (tp->lost_skb_hint) {
- skb = tp->lost_skb_hint;
- cnt = tp->lost_cnt_hint;
+ skb = tp->lost_skb_hint;
+ if (skb) {
/* Head already handled? */
- if (mark_head && skb != tcp_write_queue_head(sk))
+ if (mark_head && after(TCP_SKB_CB(skb)->seq, tp->snd_una))
return;
+ cnt = tp->lost_cnt_hint;
} else {
skb = tcp_write_queue_head(sk);
cnt = 0;