git: socket: Speed up soclose by avoiding putting the user threa

看板DFBSD_commit作者時間14年前 (2011/12/28 02:04), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
commit acd31a69ea41698798c8dcc03369dd7c70e4741e Author: Sepherosa Ziehau <sephe@dragonflybsd.org> Date: Sun Nov 20 19:25:05 2011 +0800 socket: Speed up soclose by avoiding putting the user thread into sleep - Embed a netmsg_base into socket, it will be used if fast soclose is possible - Factor out sodiscard(), which abort the connections on the listen socket and set the SS_NOFDREF bit. This function is shared across fast soclose and synchronized soclose - Rename the original soclose() to soclose_sync(), which uses domsg to perform proto-specific operation - If kern.ipc.soclose_fast is 1 (it is 1 by default) and SO_LINGER socket option is not set and the socket does not use synchronized msgport (e.g. UNIX domain socket), fast soclose will be used - The fast soclose is implemented to avoid putting the caller thread (usually a user thread) into sleep. It uses the socket's embeded "close message" with different dispatch functions based on the current socket state and send the "close message" (asynchronized) to proto thread to carry out various tasks. The result: On Phenom 9550 (4 core, 2.2GHz): route change -host 127.0.0.1 -msl 50 (set MSL to 50ms) 8 parallel netperf -H 127.0.0.1 -t TCP_CC -P0 (4 runs, unit: tps) old 33181.18 33005.66 33130.48 33010.50 new 39109.07 39032.48 39022.75 38993.72 This gives 18% performance improvement Summary of changes: sys/kern/uipc_msg.c | 26 +++++++ sys/kern/uipc_socket.c | 169 ++++++++++++++++++++++++++++++++++++++++------- sys/sys/socketops.h | 2 + sys/sys/socketvar.h | 6 ++ 4 files changed, 177 insertions(+), 26 deletions(-) http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/acd31a69ea41698798c8dcc03369dd7c70e4741e -- DragonFly BSD source repository
文章代碼(AID): #1E-WYQG1 (DFBSD_commit)