Print this page
916 False-sharing in TCP hash buckets, plus size increase
        (originally Joyent OS-299 tcp_bindi() hash lock contention affects
        TCP client performance)


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.

  24  */
  25 /* Copyright (c) 1990 Mentat Inc. */
  26 
  27 #include <sys/types.h>
  28 #include <sys/stream.h>
  29 #include <sys/strsun.h>
  30 #include <sys/strsubr.h>
  31 #include <sys/stropts.h>
  32 #include <sys/strlog.h>
  33 #define _SUN_TPI_VERSION 2
  34 #include <sys/tihdr.h>
  35 #include <sys/timod.h>
  36 #include <sys/ddi.h>
  37 #include <sys/sunddi.h>
  38 #include <sys/suntpi.h>
  39 #include <sys/xti_inet.h>
  40 #include <sys/cmn_err.h>
  41 #include <sys/debug.h>
  42 #include <sys/sdt.h>
  43 #include <sys/vtrace.h>


 223  */
 224 int tcp_squeue_wput = 2;        /* /etc/systems */
 225 int tcp_squeue_flag;
 226 
 227 /*
 228  * To prevent memory hog, limit the number of entries in tcp_free_list
 229  * to 1% of available memory / number of cpus
 230  */
 231 uint_t tcp_free_list_max_cnt = 0;
 232 
 233 #define TCP_XMIT_LOWATER        4096
 234 #define TCP_XMIT_HIWATER        49152
 235 #define TCP_RECV_LOWATER        2048
 236 #define TCP_RECV_HIWATER        128000
 237 
 238 #define TIDUSZ  4096    /* transport interface data unit size */
 239 
 240 /*
 241  * Size of acceptor hash list.  It has to be a power of 2 for hashing.
 242  */
 243 #define TCP_ACCEPTOR_FANOUT_SIZE                256
 244 
 245 #ifdef  _ILP32
 246 #define TCP_ACCEPTOR_HASH(accid)                                        \
 247                 (((uint_t)(accid) >> 8) & (TCP_ACCEPTOR_FANOUT_SIZE - 1))
 248 #else
 249 #define TCP_ACCEPTOR_HASH(accid)                                        \
 250                 ((uint_t)(accid) & (TCP_ACCEPTOR_FANOUT_SIZE - 1))
 251 #endif  /* _ILP32 */
 252 
 253 /*
 254  * Minimum number of connections which can be created per listener.  Used
 255  * when the listener connection count is in effect.
 256  */
 257 static uint32_t tcp_min_conn_listener = 2;
 258 
 259 uint32_t tcp_early_abort = 30;
 260 
 261 /* TCP Timer control structure */
 262 typedef struct tcpt_s {
 263         pfv_t   tcpt_pfv;       /* The routine we are to call */




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2011, Joyent Inc. All rights reserved.
  25  */
  26 /* Copyright (c) 1990 Mentat Inc. */
  27 
  28 #include <sys/types.h>
  29 #include <sys/stream.h>
  30 #include <sys/strsun.h>
  31 #include <sys/strsubr.h>
  32 #include <sys/stropts.h>
  33 #include <sys/strlog.h>
  34 #define _SUN_TPI_VERSION 2
  35 #include <sys/tihdr.h>
  36 #include <sys/timod.h>
  37 #include <sys/ddi.h>
  38 #include <sys/sunddi.h>
  39 #include <sys/suntpi.h>
  40 #include <sys/xti_inet.h>
  41 #include <sys/cmn_err.h>
  42 #include <sys/debug.h>
  43 #include <sys/sdt.h>
  44 #include <sys/vtrace.h>


 224  */
 225 int tcp_squeue_wput = 2;        /* /etc/systems */
 226 int tcp_squeue_flag;
 227 
 228 /*
 229  * To prevent memory hog, limit the number of entries in tcp_free_list
 230  * to 1% of available memory / number of cpus
 231  */
 232 uint_t tcp_free_list_max_cnt = 0;
 233 
 234 #define TCP_XMIT_LOWATER        4096
 235 #define TCP_XMIT_HIWATER        49152
 236 #define TCP_RECV_LOWATER        2048
 237 #define TCP_RECV_HIWATER        128000
 238 
 239 #define TIDUSZ  4096    /* transport interface data unit size */
 240 
 241 /*
 242  * Size of acceptor hash list.  It has to be a power of 2 for hashing.
 243  */
 244 #define TCP_ACCEPTOR_FANOUT_SIZE                512
 245 
 246 #ifdef  _ILP32
 247 #define TCP_ACCEPTOR_HASH(accid)                                        \
 248                 (((uint_t)(accid) >> 8) & (TCP_ACCEPTOR_FANOUT_SIZE - 1))
 249 #else
 250 #define TCP_ACCEPTOR_HASH(accid)                                        \
 251                 ((uint_t)(accid) & (TCP_ACCEPTOR_FANOUT_SIZE - 1))
 252 #endif  /* _ILP32 */
 253 
 254 /*
 255  * Minimum number of connections which can be created per listener.  Used
 256  * when the listener connection count is in effect.
 257  */
 258 static uint32_t tcp_min_conn_listener = 2;
 259 
 260 uint32_t tcp_early_abort = 30;
 261 
 262 /* TCP Timer control structure */
 263 typedef struct tcpt_s {
 264         pfv_t   tcpt_pfv;       /* The routine we are to call */