Subject: Heads up: major socket performance improvement
To: None <current-users@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: current-users
Date: 07/03/2002 12:32:40
Folks...

I just committed the following to the NetBSD-current source tree,
and bumped the OS revision to 1.6C.  For some applications, this
can be a pretty major performance improvement.

It is entirely possible that I broke a corner case.  If you encounter
any problems with this code, please submit a bug report immediately
with send-pr, with as much information as possible.  That said, I've
exercised this pretty well today, and haven't encounterd eny problems.

Enjoy!

----- Forwarded message from Jason R Thorpe <thorpej@netbsd.org> -----

To: source-changes@netbsd.org
Date: Wed,  3 Jul 2002 22:06:56 +0300 (EEST)
From: Jason R Thorpe <thorpej@netbsd.org>
Subject: CVS commit: syssrc/sys


Module Name:	syssrc
Committed By:	thorpej
Date:		Wed Jul  3 19:06:55 UTC 2002

Modified Files:
	syssrc/sys/dev: kttcp.c
	syssrc/sys/kern: uipc_socket.c uipc_socket2.c
	syssrc/sys/netccitt: if_x25subr.c pk_output.c pk_usrreq.c
	syssrc/sys/netinet: tcp_input.c tcp_usrreq.c
	syssrc/sys/sys: socketvar.h

Log Message:
Make insertion of data into socket buffers O(C):
* Keep pointers to the first and last mbufs of the last record in the
  socket buffer.
* Use the sb_lastrecord pointer in the sbappend*() family of functions
  to avoid traversing the packet chain to find the last record.
* Add a new sbappend_stream() function for stream protocols which
  guarantee that there will never be more than one record in the
  socket buffer.  This function uses the sb_mbtail pointer to perform
  the data insertion.  Make TCP use sbappend_stream().

On a profiling run, this makes sbappend of a TCP transmission using
a 1M socket buffer go from 50% of the time to .02% of the time.

Thanks to Bill Sommerfeld and YAMAMOTO Takashi for their debugging
assistance!


To generate a diff of this commit:
cvs rdiff -r1.1 -r1.2 syssrc/sys/dev/kttcp.c
cvs rdiff -r1.68 -r1.69 syssrc/sys/kern/uipc_socket.c
cvs rdiff -r1.42 -r1.43 syssrc/sys/kern/uipc_socket2.c
cvs rdiff -r1.28 -r1.29 syssrc/sys/netccitt/if_x25subr.c
cvs rdiff -r1.16 -r1.17 syssrc/sys/netccitt/pk_output.c
cvs rdiff -r1.21 -r1.22 syssrc/sys/netccitt/pk_usrreq.c
cvs rdiff -r1.146 -r1.147 syssrc/sys/netinet/tcp_input.c
cvs rdiff -r1.71 -r1.72 syssrc/sys/netinet/tcp_usrreq.c
cvs rdiff -r1.51 -r1.52 syssrc/sys/sys/socketvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.


----- End forwarded message -----

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>