Skip to content

Commit 5e76ee4

Browse files
Eric Dumazetdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4e8cc22 commit 5e76ee4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/ipv4/tcp_input.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,12 +2207,12 @@ static void tcp_mark_head_lost(struct sock *sk, int packets, int mark_head)
22072207
const u32 loss_high = tcp_is_sack(tp) ? tp->snd_nxt : tp->high_seq;
22082208

22092209
WARN_ON(packets > tp->packets_out);
2210-
if (tp->lost_skb_hint) {
2211-
skb = tp->lost_skb_hint;
2212-
cnt = tp->lost_cnt_hint;
2210+
skb = tp->lost_skb_hint;
2211+
if (skb) {
22132212
/* Head already handled? */
2214-
if (mark_head && skb != tcp_write_queue_head(sk))
2213+
if (mark_head && after(TCP_SKB_CB(skb)->seq, tp->snd_una))
22152214
return;
2215+
cnt = tp->lost_cnt_hint;
22162216
} else {
22172217
skb = tcp_write_queue_head(sk);
22182218
cnt = 0;

0 commit comments

Comments
 (0)