git: kernel - Improve TCP socket handling at high speeds

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Jul 15 20:36:55 PDT 2014


commit 11b81f5d7090a4c01df8c0e17a07b3a3d89b32be
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Jul 15 20:27:51 2014 -0700

    kernel - Improve TCP socket handling at high speeds
    
    * Add M_SOLOCKED to mbuf->m_flags.  This flag prevents sbcompress()
      from collapsing more data into a mbuf.
    
    * Rewrite sorecvtcp() (NOTE: soreceive() could use similar treatment).
      Use M_SOLOCKED to freeze mbufs in the sockbuf with the rcvtok held,
      then do the uiomove() loop WITHOUT the rcvtok held, then finalize
      the disposal of the mbufs with rcvtok held.
    
      This greatly reduces contention on rcvtok against the netisr threads
      when reading large amounts of data at once and reduces cpu overhead
      for netisr and user network threads.
    
    * Change the default transmit ssb_lowat from ssb_hiwat / 2 to ssb_hiwat / 4.
      The (previous) default maximum socket buffer size was 256KB.  The default
      lowat reduced the effective TCP transmit window to ~100KB.  This can cause
      severe buffering issues on GiGE links when multiple TCP streams are being
      routed to the same cpu.
    
      With this change the default max send buffer is ~180KB or so.
    
    * Change the default kern.ipc.maxsockbuf from 256KB to 512KB.  This
      primarily effects auto-sizing of tcp buffers which in turn effects
      most TCP connections.
    
      This coupled with the hiwat fix greatly improves transmit throughput.
    
    * Add more debugging info to the tcp inflight code.

Summary of changes:
 sys/kern/uipc_sockbuf.c |   9 ++-
 sys/kern/uipc_socket.c  | 175 ++++++++++++++++++++++++++++++++++--------------
 sys/kern/uipc_socket2.c |   2 +-
 sys/netinet/tcp_subr.c  |  11 +--
 sys/sys/mbuf.h          |   1 +
 sys/sys/sockbuf.h       |   2 +-
 6 files changed, 142 insertions(+), 58 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/11b81f5d7090a4c01df8c0e17a07b3a3d89b32be


-- 
DragonFly BSD source repository


More information about the Commits mailing list