netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: better use ooo_last_skb in tcp_data_queue_ofo()
@ 2016-09-09 21:22 Eric Dumazet
  2016-09-11  4:43 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2016-09-09 21:22 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, Willem de Bruijn, Yaogong Wang, Yuchung Cheng,
	Neal Cardwell, Ilpo Järvinen

From: Eric Dumazet <edumazet@google.com>

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>
---
 net/ipv4/tcp_input.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a5934c4c8cd4..2e26f3eb0293 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4461,6 +4461,12 @@ coalesce_done:
 		skb = NULL;
 		goto add_sack;
 	}
+	/* Can avoid an rbtree lookup if we are adding skb after ooo_last_skb */
+	if (!before(seq, TCP_SKB_CB(tp->ooo_last_skb)->end_seq)) {
+		parent = &tp->ooo_last_skb->rbnode;
+		p = &parent->rb_right;
+		goto insert;
+	}
 
 	/* Find place to insert this segment. Handle overlaps on the way. */
 	parent = NULL;
@@ -4503,7 +4509,7 @@ coalesce_done:
 		}
 		p = &parent->rb_right;
 	}
-
+insert:
 	/* Insert segment into RB tree. */
 	rb_link_node(&skb->rbnode, parent, p);
 	rb_insert_color(&skb->rbnode, &tp->out_of_order_queue);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] tcp: better use ooo_last_skb in tcp_data_queue_ofo()
  2016-09-09 21:22 [PATCH net-next] tcp: better use ooo_last_skb in tcp_data_queue_ofo() Eric Dumazet
@ 2016-09-11  4:43 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-09-11  4:43 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, willemb, wygivan, ycheng, ncardwell, ilpo.jarvinen

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 09 Sep 2016 14:22:45 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-11  4:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-09 21:22 [PATCH net-next] tcp: better use ooo_last_skb in tcp_data_queue_ofo() Eric Dumazet
2016-09-11  4:43 ` David Miller

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).