[rds-commits] zab commits r80 - in trunk: . linux/net/rds

svn-commits@oss.oracle.com svn-commits at oss.oracle.com
Fri May 26 15:48:59 CDT 2006


Author: zab
Date: 2006-05-26 15:48:57 -0500 (Fri, 26 May 2006)
New Revision: 80

Modified:
   trunk/TODO
   trunk/linux/net/rds/tcp.c
   trunk/linux/net/rds/tcp.h
   trunk/linux/net/rds/tcp_connect.c
   trunk/linux/net/rds/tcp_listen.c
Log:
Centralize TCP socket tunning.

Set the send and receive buffers to a larger value, though maybe this should be
tunable.

We don't have any senders in weird contexts so we can use the default
sk_allocation.

Only the listening socket needs sk_reuse.


Modified: trunk/TODO
===================================================================
--- trunk/TODO	2006-05-26 00:35:25 UTC (rev 79)
+++ trunk/TODO	2006-05-26 20:48:57 UTC (rev 80)
@@ -1,4 +1,10 @@
 
+OK, the ack complexity was overly aggressive.  Instead of queueing
+incs we should mark the last acked in the flow and queue the flow
+as needing to generate the ack.  10ms is absolutely too long, too,
+of course.  I vote for simple now and something more complicated
+only once we have a load that suffers from it that we can profile.
+
 clean up sending forward progress
 
 oh, right, poll().  POLLIN does things, POLLOUT always returns true :/

Modified: trunk/linux/net/rds/tcp.c
===================================================================
--- trunk/linux/net/rds/tcp.c	2006-05-26 00:35:25 UTC (rev 79)
+++ trunk/linux/net/rds/tcp.c	2006-05-26 20:48:57 UTC (rev 80)
@@ -19,7 +19,7 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/in.h>
-#include <net/route.h>
+#include <net/tcp.h>
 
 #include "rds.h"
 #include "tcp.h"
@@ -27,6 +27,25 @@
 static kmem_cache_t *rds_tcp_conn_slab;
 struct workqueue_struct *rds_tcp_wq;
 
+#define RDS_TCP_DEFAULT_BUFSIZE (128 * 1024)
+
+void rds_tcp_tune(struct sock *sk)
+{
+	struct tcp_sock *tp = tcp_sk(sk);
+
+	tp->nonagle = TCP_NAGLE_OFF;
+
+	/*
+	 * We're trying to saturate gigabit with the default,
+	 * see svc_sock_setbufsize().
+	 */
+	lock_sock(sk);
+	sk->sk_sndbuf = RDS_TCP_DEFAULT_BUFSIZE;
+	sk->sk_rcvbuf = RDS_TCP_DEFAULT_BUFSIZE;
+	sk->sk_userlocks |= SOCK_SNDBUF_LOCK|SOCK_RCVBUF_LOCK;
+	release_sock(sk);
+}
+
 void rds_tcp_restore_callbacks(struct socket *sock,
 			       struct rds_tcp_connection *tc)
 {

Modified: trunk/linux/net/rds/tcp.h
===================================================================
--- trunk/linux/net/rds/tcp.h	2006-05-26 00:35:25 UTC (rev 79)
+++ trunk/linux/net/rds/tcp.h	2006-05-26 20:48:57 UTC (rev 80)
@@ -38,6 +38,7 @@
 /* tcp.c */
 int __init rds_tcp_init(void);
 void __exit rds_tcp_exit(void);
+void rds_tcp_tune(struct sock *sk);
 void rds_tcp_set_callbacks(struct socket *sock, struct rds_tcp_connection *tc);
 void rds_tcp_restore_callbacks(struct socket *sock,
 			       struct rds_tcp_connection *tc);

Modified: trunk/linux/net/rds/tcp_connect.c
===================================================================
--- trunk/linux/net/rds/tcp_connect.c	2006-05-26 00:35:25 UTC (rev 79)
+++ trunk/linux/net/rds/tcp_connect.c	2006-05-26 20:48:57 UTC (rev 80)
@@ -69,7 +69,6 @@
 	struct rds_connection *conn = tc->t_conn;
 	struct socket *sock = NULL;
 	struct sockaddr_in src, dest;
-	struct tcp_sock *tp;
 	int ret;
 
 	if (conn == NULL) {
@@ -87,14 +86,7 @@
 	if (ret < 0)
 		goto out;
 
-	/* 
-	 * XXX should probably put these in a helper and also hit the
-	 * socket buffer sizes while we're at it.
-	 */
-	sock->sk->sk_allocation = GFP_ATOMIC; /* XXX maybe bad */
-	tp = tcp_sk(sock->sk);
-	tp->nonagle = TCP_NAGLE_OFF;
-	sock->sk->sk_reuse = 1;
+	rds_tcp_tune(sock->sk);
 
 	src.sin_family = AF_INET;
 	src.sin_addr.s_addr = (__force u32)conn->c_laddr;

Modified: trunk/linux/net/rds/tcp_listen.c
===================================================================
--- trunk/linux/net/rds/tcp_listen.c	2006-05-26 00:35:25 UTC (rev 79)
+++ trunk/linux/net/rds/tcp_listen.c	2006-05-26 20:48:57 UTC (rev 80)
@@ -34,7 +34,6 @@
 static int rds_tcp_accept_one(struct socket *sock)
 {
 	struct socket *new_sock = NULL;
-	struct tcp_sock *tp;
 	struct rds_connection *conn;
 	struct inet_sock *inet;
 	struct rds_tcp_connection *tc;
@@ -51,9 +50,7 @@
 	if (ret < 0)
 		goto out;
 
-	new_sock->sk->sk_allocation = GFP_ATOMIC;
-	tp = tcp_sk(new_sock->sk);
-	tp->nonagle = TCP_NAGLE_OFF;
+	rds_tcp_tune(new_sock->sk);
 
 	inet = inet_sk(new_sock->sk);
 
@@ -140,7 +137,6 @@
 	if (ret < 0)
 		goto out;
 
-	sock->sk->sk_allocation = GFP_ATOMIC;
 	sock->sk->sk_reuse = 1;
 	tp = tcp_sk(sock->sk);
 	tp->nonagle = TCP_NAGLE_OFF;




More information about the rds-commits mailing list