changeset 10103:9f794dd04dc3

6844855 8.72% snv_115 vol25_09_loopback_32bit performance regression x86
author Anders Persson <Anders.Persson@Sun.COM>
date Thu, 09 Jul 2009 15:48:00 -0700
parents 798d200971c9
children 915ce9b192fd
files usr/src/uts/common/fs/sockfs/sockcommon_sops.c usr/src/uts/common/fs/sockfs/sodirect.c usr/src/uts/common/inet/tcp/tcp.c usr/src/uts/common/sys/socket_proto.h
diffstat 4 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/sockfs/sockcommon_sops.c	Thu Jul 09 16:27:50 2009 -0700
+++ b/usr/src/uts/common/fs/sockfs/sockcommon_sops.c	Thu Jul 09 15:48:00 2009 -0700
@@ -1129,6 +1129,8 @@
 		so->so_proto_props.sopp_rcvthresh = soppp->sopp_rcvthresh;
 	if (soppp->sopp_flags & SOCKOPT_MAXADDRLEN)
 		so->so_proto_props.sopp_maxaddrlen = soppp->sopp_maxaddrlen;
+	if (soppp->sopp_flags & SOCKOPT_LOOPBACK)
+		so->so_proto_props.sopp_loopback = soppp->sopp_loopback;
 
 	mutex_exit(&so->so_lock);
 
@@ -1136,7 +1138,8 @@
 	soppp->sopp_flags &= ~(SOCKOPT_MAXBLK | SOCKOPT_WROFF | SOCKOPT_TAIL |
 	    SOCKOPT_RCVHIWAT | SOCKOPT_RCVLOWAT | SOCKOPT_MAXPSZ |
 	    SOCKOPT_ZCOPY | SOCKOPT_OOBINLINE | SOCKOPT_RCVTIMER |
-	    SOCKOPT_RCVTHRESH | SOCKOPT_MAXADDRLEN | SOCKOPT_MINPSZ);
+	    SOCKOPT_RCVTHRESH | SOCKOPT_MAXADDRLEN | SOCKOPT_MINPSZ |
+	    SOCKOPT_LOOPBACK);
 	ASSERT(soppp->sopp_flags == 0);
 #endif
 }
--- a/usr/src/uts/common/fs/sockfs/sodirect.c	Thu Jul 09 16:27:50 2009 -0700
+++ b/usr/src/uts/common/fs/sockfs/sodirect.c	Thu Jul 09 15:48:00 2009 -0700
@@ -78,6 +78,7 @@
 	if (uiop->uio_resid >= uioasync.mincnt &&
 	    sodp != NULL && sodp->sod_enabled &&
 	    uioasync.enabled && !(flags & MSG_PEEK) &&
+	    !so->so_proto_props.sopp_loopback &&
 	    !(so->so_state & SS_CANTRCVMORE)) {
 		/*
 		 * Big enough I/O for uioa min setup and an sodirect socket
--- a/usr/src/uts/common/inet/tcp/tcp.c	Thu Jul 09 16:27:50 2009 -0700
+++ b/usr/src/uts/common/inet/tcp/tcp.c	Thu Jul 09 15:48:00 2009 -0700
@@ -17371,6 +17371,10 @@
 			sopp.sopp_tail = sopp_tail;
 			sopp.sopp_zcopyflag = sopp_copyopt;
 		}
+		if (tcp->tcp_loopback) {
+			sopp.sopp_flags |= SOCKOPT_LOOPBACK;
+			sopp.sopp_loopback = B_TRUE;
+		}
 		(*connp->conn_upcalls->su_set_proto_props)
 		    (connp->conn_upper_handle, &sopp);
 	} else {
@@ -26463,6 +26467,16 @@
 			error = proto_tlitosyserr(-error);
 		}
 	}
+
+	if (tcp->tcp_loopback) {
+		struct sock_proto_props sopp;
+
+		sopp.sopp_flags = SOCKOPT_LOOPBACK;
+		sopp.sopp_loopback = B_TRUE;
+
+		(*connp->conn_upcalls->su_set_proto_props)(
+		    connp->conn_upper_handle, &sopp);
+	}
 done:
 	squeue_synch_exit(sqp, connp);
 
--- a/usr/src/uts/common/sys/socket_proto.h	Thu Jul 09 16:27:50 2009 -0700
+++ b/usr/src/uts/common/sys/socket_proto.h	Thu Jul 09 15:48:00 2009 -0700
@@ -60,6 +60,7 @@
 	uint_t sopp_rcvtimer;		/* delayed recv notification (time) */
 	uint32_t sopp_rcvthresh;	/* delayed recv notification (bytes) */
 	socklen_t sopp_maxaddrlen;	/* maximum size of protocol address */
+	boolean_t sopp_loopback;	/* loopback connection */
 };
 
 /* flags to determine which socket options are set */
@@ -75,6 +76,7 @@
 #define	SOCKOPT_RCVTHRESH	0x0200
 #define	SOCKOPT_MAXADDRLEN	0x0400	/* set max address length */
 #define	SOCKOPT_MINPSZ		0x0800	/* set minpsz for protocols */
+#define	SOCKOPT_LOOPBACK	0x1000	/* set loopback */
 
 #define	IS_SO_OOB_INLINE(so)	((so)->so_proto_props.sopp_oobinline)