aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2016-09-09 17:22:45 -0400
committerDavid S. Miller <davem@davemloft.net>2016-09-11 00:43:41 -0400
commit2594a2a928a010bf27e6545f90bc2de7ed5ed075 (patch)
treeb2de76a940a8496e7402398f28aee86bdbe5290f /net/ipv4/tcp_input.c
parented227099dac95128e2aecd62af51bb9d922e5977 (diff)
tcp: better use ooo_last_skb in tcp_data_queue_ofo()
Willem noticed that we could avoid an rbtree lookup if the the attempt to coalesce incoming skb to the last skb failed for some reason. Since most ooo additions are at the tail, this is definitely worth adding a test and fast path. Suggested-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Yaogong Wang <wygivan@google.com> Cc: Yuchung Cheng <ycheng@google.com> Cc: Neal Cardwell <ncardwell@google.com> Cc: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a5934c4c8cd4..70b892db9901 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4461,6 +4461,12 @@ coalesce_done:
4461 skb = NULL; 4461 skb = NULL;
4462 goto add_sack; 4462 goto add_sack;
4463 } 4463 }
4464 /* Can avoid an rbtree lookup if we are adding skb after ooo_last_skb */
4465 if (!before(seq, TCP_SKB_CB(tp->ooo_last_skb)->end_seq)) {
4466 parent = &tp->ooo_last_skb->rbnode;
4467 p = &parent->rb_right;
4468 goto insert;
4469 }
4464 4470
4465 /* Find place to insert this segment. Handle overlaps on the way. */ 4471 /* Find place to insert this segment. Handle overlaps on the way. */
4466 parent = NULL; 4472 parent = NULL;
@@ -4503,7 +4509,7 @@ coalesce_done:
4503 } 4509 }
4504 p = &parent->rb_right; 4510 p = &parent->rb_right;
4505 } 4511 }
4506 4512insert:
4507 /* Insert segment into RB tree. */ 4513 /* Insert segment into RB tree. */
4508 rb_link_node(&skb->rbnode, parent, p); 4514 rb_link_node(&skb->rbnode, parent, p);
4509 rb_insert_color(&skb->rbnode, &tp->out_of_order_queue); 4515 rb_insert_color(&skb->rbnode, &tp->out_of_order_queue);