socket: Use modulo-N for SO_REUSEPORT socket locating
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 22 Jul 2013 05:15:50 +0000 (13:15 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 22 Jul 2013 05:15:50 +0000 (13:15 +0800)
commitc275f18d832361be28b150d3f4fd518914bdeba6
treedcda75ec7570005742ff275124e017ad55ec43e3
parentda633f87cff183bc2c0c4c185762080febcf4623
socket: Use modulo-N for SO_REUSEPORT socket locating

This greatly reduces TCP listen socket completion queue pool token
contention thus saves more cpu time.

When the testing box (i7-2600, broadcom 5719) is doing 335Kconns/s,
TCP listen socket completion queue token contention is reduced from
20K/s to 500/s and the idle time on each hyperthread is increased by
~5%.
sys/netinet/in_pcb.c