Re: RFC: Nagle latency tuning

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andi Kleen
Date: Tuesday, September 9, 2008 - 12:07 pm

> These apps have a love/hate relationship with TCP.  They'll probably love 

Then they should just TCP_NODELAY.


That's the right thing for them.


Hmm in theory I don't see a big drawback in making the these defaults sysctls.
As in this untested patch. It's probably not the right solution
for this problem. Still if you want to experiment. This makes both 
the ato default and the delack default tunable. You'll have to restart
sockets for it to take effect.

-Andi

---


Make ato min and delack min tunable 

This might potentially help with some programs which have problems with nagle.

Sockets have to be restarted

TBD documentation for the new sysctls

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Index: linux-2.6.27-rc4-misc/include/net/tcp.h
===================================================================
--- linux-2.6.27-rc4-misc.orig/include/net/tcp.h
+++ linux-2.6.27-rc4-misc/include/net/tcp.h
@@ -118,12 +118,16 @@ extern void tcp_time_wait(struct sock *s
 
 #define TCP_DELACK_MAX	((unsigned)(HZ/5))	/* maximal time to delay before sending an ACK */
 #if HZ >= 100
-#define TCP_DELACK_MIN	((unsigned)(HZ/25))	/* minimal time to delay before sending an ACK */
-#define TCP_ATO_MIN	((unsigned)(HZ/25))
+#define TCP_DELACK_MIN_DEFAULT	((unsigned)(HZ/25))	/* minimal time to delay before sending an ACK */
+#define TCP_ATO_MIN_DEFAULT	((unsigned)(HZ/25))
 #else
-#define TCP_DELACK_MIN	4U
-#define TCP_ATO_MIN	4U
+#define TCP_DELACK_MIN_DEFAULT	4U
+#define TCP_ATO_MIN_DEFAULT	4U
 #endif
+
+#define TCP_DELACK_MIN sysctl_tcp_delack_min
+#define TCP_ATO_MIN sysctl_tcp_ato_min
+
 #define TCP_RTO_MAX	((unsigned)(120*HZ))
 #define TCP_RTO_MIN	((unsigned)(HZ/5))
 #define TCP_TIMEOUT_INIT ((unsigned)(3*HZ))	/* RFC 1122 initial RTO value	*/
@@ -236,6 +240,8 @@ extern int sysctl_tcp_base_mss;
 extern int sysctl_tcp_workaround_signed_windows;
 extern int sysctl_tcp_slow_start_after_idle;
 extern int sysctl_tcp_max_ssthresh;
+extern int sysctl_tcp_ato_min;
+extern int sysctl_tcp_delack_min;
 
 extern atomic_t tcp_memory_allocated;
 extern atomic_t tcp_sockets_allocated;
Index: linux-2.6.27-rc4-misc/net/ipv4/sysctl_net_ipv4.c
===================================================================
--- linux-2.6.27-rc4-misc.orig/net/ipv4/sysctl_net_ipv4.c
+++ linux-2.6.27-rc4-misc/net/ipv4/sysctl_net_ipv4.c
@@ -717,6 +717,24 @@ static struct ctl_table ipv4_table[] = {
 	},
 	{
 		.ctl_name	= CTL_UNNUMBERED,
+		.procname	= "tcp_delack_min",
+		.data		= &sysctl_tcp_delack_min,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_jiffies,
+		.strategy	= &sysctl_jiffies
+	},
+	{
+		.ctl_name	= CTL_UNNUMBERED,
+		.procname	= "tcp_ato_min",
+		.data		= &sysctl_tcp_ato_min,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_jiffies,
+		.strategy	= &sysctl_jiffies
+	},
+	{
+		.ctl_name	= CTL_UNNUMBERED,
 		.procname	= "udp_mem",
 		.data		= &sysctl_udp_mem,
 		.maxlen		= sizeof(sysctl_udp_mem),
Index: linux-2.6.27-rc4-misc/net/ipv4/tcp_timer.c
===================================================================
--- linux-2.6.27-rc4-misc.orig/net/ipv4/tcp_timer.c
+++ linux-2.6.27-rc4-misc/net/ipv4/tcp_timer.c
@@ -29,6 +29,8 @@ int sysctl_tcp_keepalive_intvl __read_mo
 int sysctl_tcp_retries1 __read_mostly = TCP_RETR1;
 int sysctl_tcp_retries2 __read_mostly = TCP_RETR2;
 int sysctl_tcp_orphan_retries __read_mostly;
+int sysctl_tcp_delack_min __read_mostly = TCP_DELACK_MIN_DEFAULT;
+int sysctl_tcp_ato_min __read_mostly = TCP_ATO_MIN_DEFAULT;
 
 static void tcp_write_timer(unsigned long);
 static void tcp_delack_timer(unsigned long);
Index: linux-2.6.27-rc4-misc/net/ipv4/tcp_output.c
===================================================================
--- linux-2.6.27-rc4-misc.orig/net/ipv4/tcp_output.c
+++ linux-2.6.27-rc4-misc/net/ipv4/tcp_output.c
@@ -2436,7 +2436,7 @@ void tcp_send_delayed_ack(struct sock *s
 		 * directly.
 		 */
 		if (tp->srtt) {
-			int rtt = max(tp->srtt >> 3, TCP_DELACK_MIN);
+			int rtt = max_t(unsigned, tp->srtt >> 3, TCP_DELACK_MIN);
 
 			if (rtt < max_ato)
 				max_ato = rtt;

-- 
ak@linux.intel.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
RFC: Nagle latency tuning, Christopher Snook, (Mon Sep 8, 2:56 pm)
Re: RFC: Nagle latency tuning, Rick Jones, (Mon Sep 8, 3:39 pm)
Re: RFC: Nagle latency tuning, Andi Kleen, (Mon Sep 8, 3:55 pm)
Re: RFC: Nagle latency tuning, Chris Snook, (Mon Sep 8, 10:10 pm)
Re: RFC: Nagle latency tuning, David Miller, (Mon Sep 8, 10:17 pm)
Re: RFC: Nagle latency tuning, Chris Snook, (Mon Sep 8, 10:22 pm)
Re: RFC: Nagle latency tuning, Chris Snook, (Mon Sep 8, 10:56 pm)
Re: RFC: Nagle latency tuning, David Miller, (Mon Sep 8, 11:02 pm)
Re: RFC: Nagle latency tuning, Evgeniy Polyakov, (Mon Sep 8, 11:22 pm)
Re: RFC: Nagle latency tuning, Chris Snook, (Mon Sep 8, 11:28 pm)
Re: RFC: Nagle latency tuning, Mark Brown, (Tue Sep 9, 3:31 am)
Re: RFC: Nagle latency tuning, David Miller, (Tue Sep 9, 5:05 am)
Re: RFC: Nagle latency tuning, Mark Brown, (Tue Sep 9, 5:09 am)
Re: RFC: Nagle latency tuning, David Miller, (Tue Sep 9, 5:19 am)
Re: RFC: Nagle latency tuning, Arnaldo Carvalho de Melo, (Tue Sep 9, 6:00 am)
Re: RFC: Nagle latency tuning, Andi Kleen, (Tue Sep 9, 7:36 am)
Re: RFC: Nagle latency tuning, Rick Jones, (Tue Sep 9, 9:33 am)
Re: RFC: Nagle latency tuning, Chuck Lever, (Tue Sep 9, 9:54 am)
Re: RFC: Nagle latency tuning, Arnaldo Carvalho de Melo, (Tue Sep 9, 10:21 am)
Re: RFC: Nagle latency tuning, Rick Jones, (Tue Sep 9, 10:54 am)
Re: RFC: Nagle latency tuning, Chris Snook, (Tue Sep 9, 11:40 am)
Re: RFC: Nagle latency tuning, Andi Kleen, (Tue Sep 9, 12:07 pm)
Re: RFC: Nagle latency tuning, Arnaldo Carvalho de Melo, (Tue Sep 9, 12:21 pm)
Re: RFC: Nagle latency tuning, David Miller, (Tue Sep 9, 12:59 pm)
Re: RFC: Nagle latency tuning, Chris Snook, (Tue Sep 9, 1:25 pm)
Re: RFC: Nagle latency tuning, Chris Snook, (Wed Sep 10, 9:08 pm)
Re: RFC: Nagle latency tuning, David Miller, (Mon Sep 22, 3:49 am)
Re: RFC: Nagle latency tuning, David Miller, (Mon Sep 22, 4:09 am)
Re: RFC: Nagle latency tuning, Andi Kleen, (Mon Sep 22, 1:30 pm)
Re: RFC: Nagle latency tuning, Chris Snook, (Mon Sep 22, 3:22 pm)
Re: RFC: Nagle latency tuning, David Miller, (Mon Sep 22, 3:26 pm)
Re: RFC: Nagle latency tuning, Rick Jones, (Mon Sep 22, 3:47 pm)
Re: RFC: Nagle latency tuning, Chris Snook, (Mon Sep 22, 3:57 pm)
Re: RFC: Nagle latency tuning, Chris Snook, (Mon Sep 22, 4:00 pm)
Re: RFC: Nagle latency tuning, David Miller, (Mon Sep 22, 4:13 pm)
Re: RFC: Nagle latency tuning, David Miller, (Mon Sep 22, 4:21 pm)
Re: RFC: Nagle latency tuning, Andi Kleen, (Mon Sep 22, 4:24 pm)
Re: RFC: Nagle latency tuning, Andi Kleen, (Mon Sep 22, 5:14 pm)
Re: RFC: Nagle latency tuning, Rick Jones, (Mon Sep 22, 5:33 pm)
Re: RFC: Nagle latency tuning, David Miller, (Mon Sep 22, 6:40 pm)
Re: RFC: Nagle latency tuning, Andi Kleen, (Mon Sep 22, 7:12 pm)
Re: RFC: Nagle latency tuning, Andi Kleen, (Mon Sep 22, 7:23 pm)
Re: RFC: Nagle latency tuning, David Miller, (Mon Sep 22, 7:28 pm)
Re: RFC: Nagle latency tuning, Andi Kleen, (Mon Sep 22, 7:41 pm)