netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bound TSO defer time (resend)
@ 2006-10-17  0:53 John Heffner
  2006-10-17  3:20 ` Stephen Hemminger
  0 siblings, 1 reply; 32+ messages in thread
From: John Heffner @ 2006-10-17  0:53 UTC (permalink / raw)
  To: netdev

The original message didn't show up on the list.  I'm assuming it's
because the filters didn't like the attached postscript.  I posted PDFs of
the figures on the web:

http://www.psc.edu/~jheffner/tmp/a.pdf
http://www.psc.edu/~jheffner/tmp/b.pdf
http://www.psc.edu/~jheffner/tmp/c.pdf

  -John


---------- Forwarded message ----------
Date: Mon, 16 Oct 2006 15:55:53 -0400 (EDT)
From: John Heffner <jheffner@psc.edu>
To: David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: [PATCH] Bound TSO defer time

This patch limits the amount of time you will defer sending a TSO segment
to less than two clock ticks, or the time between two acks, whichever is
longer.

On slow links, deferring causes significant bursts.  See attached plots,
which show RTT through a 1 Mbps link with a 100 ms RTT and ~100 ms queue
for (a) non-TSO, (b) currnet TSO, and (c) patched TSO.  This burstiness
causes significant jitter, tends to overflow queues early (bad for short
queues), and makes delay-based congestion control more difficult.

Deferring by a couple clock ticks I believe will have a relatively small
impact on performance.


Signed-off-by: John Heffner <jheffner@psc.edu>


diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0e058a2..27ae4b2 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -341,7 +341,9 @@ #endif
 	int			linger2;

 	unsigned long last_synq_overflow;
-
+
+	__u32	tso_deferred;
+
 /* Receiver side RTT estimation */
 	struct {
 		__u32	rtt;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 9a253fa..3ea8973 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1087,11 +1087,15 @@ static int tcp_tso_should_defer(struct s
 	u32 send_win, cong_win, limit, in_flight;

 	if (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)
-		return 0;
+		goto send_now;

 	if (icsk->icsk_ca_state != TCP_CA_Open)
-		return 0;
+		goto send_now;

+	/* Defer for less than two clock ticks. */
+	if (!tp->tso_deferred && ((jiffies<<1)>>1) - (tp->tso_deferred>>1) > 1)
+		goto send_now;
+
 	in_flight = tcp_packets_in_flight(tp);

 	BUG_ON(tcp_skb_pcount(skb) <= 1 ||
@@ -1106,8 +1110,8 @@ static int tcp_tso_should_defer(struct s

 	/* If a full-sized TSO skb can be sent, do it. */
 	if (limit >= 65536)
-		return 0;
-
+		goto send_now;
+
 	if (sysctl_tcp_tso_win_divisor) {
 		u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache);

@@ -1116,7 +1120,7 @@ static int tcp_tso_should_defer(struct s
 		 */
 		chunk /= sysctl_tcp_tso_win_divisor;
 		if (limit >= chunk)
-			return 0;
+			goto send_now;
 	} else {
 		/* Different approach, try not to defer past a single
 		 * ACK.  Receiver should ACK every other full sized
@@ -1124,11 +1128,17 @@ static int tcp_tso_should_defer(struct s
 		 * then send now.
 		 */
 		if (limit > tcp_max_burst(tp) * tp->mss_cache)
-			return 0;
+			goto send_now;
 	}
-
+
 	/* Ok, it looks like it is advisable to defer.  */
+	tp->tso_deferred = 1 | (jiffies<<1);
+
 	return 1;
+
+send_now:
+	tp->tso_deferred = 0;
+	return 0;
 }

 /* Create a new MTU probe if we are ready.

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

end of thread, other threads:[~2006-10-20 14:21 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-17  0:53 [PATCH] Bound TSO defer time (resend) John Heffner
2006-10-17  3:20 ` Stephen Hemminger
2006-10-17  4:18   ` John Heffner
2006-10-17  5:35     ` David Miller
2006-10-17 12:22       ` John Heffner
2006-10-19  3:39         ` David Miller
2006-10-17 12:58       ` [PATCH] [NET] Size listen hash tables using backlog hint Eric Dumazet Hi
2006-10-18  7:38         ` [PATCH] [NET] inet_peer : group together avl_left, avl_right, v4daddr to speedup lookups on some CPUS Eric Dumazet
2006-10-18 16:35           ` [PATCH] [NET] reduce per cpu ram used for loopback stats Eric Dumazet
2006-10-18 17:00             ` [PATCH, resent] " Eric Dumazet
2006-10-19  3:53               ` David Miller
2006-10-19  3:53             ` [PATCH] " David Miller
2006-10-19  3:44           ` [PATCH] [NET] inet_peer : group together avl_left, avl_right, v4daddr to speedup lookups on some CPUS David Miller
2006-10-19 10:57           ` Eric Dumazet
2006-10-19 15:45             ` [PATCH] [NET] One NET_INC_STATS() could be NET_INC_STATS_BH in tcp_v4_err() Eric Dumazet
2006-10-20  7:22               ` David Miller
2006-10-20 14:21                 ` Arnaldo Carvalho de Melo
2006-10-20  7:28             ` [PATCH] [NET] inet_peer : group together avl_left, avl_right, v4daddr to speedup lookups on some CPUS David Miller
2006-10-19  3:31         ` [PATCH] [NET] Size listen hash tables using backlog hint David Miller
2006-10-19  4:54           ` Stephen Hemminger
2006-10-19  5:08             ` David Miller
2006-10-19  5:12           ` Eric Dumazet
2006-10-19  6:12             ` David Miller
2006-10-19  6:34               ` Eric Dumazet
2006-10-19  6:57                 ` David Miller
2006-10-19  8:29                   ` Eric Dumazet
2006-10-19  8:41                     ` David Miller
2006-10-19  9:11                       ` Eric Dumazet
2006-10-19  9:27         ` Eric Dumazet
2006-10-20  7:27           ` David Miller
2006-10-18 15:37     ` [PATCH] Bound TSO defer time (resend) Andi Kleen
2006-10-18 16:40       ` Stephen Hemminger

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