git: tcp: Use 4-tuple hash to optimize local port selection.

Sepherosa Ziehau sephe at
Thu Oct 29 20:40:24 PDT 2015

commit 02353b181a6deaef5e813abfa1c41a2de5fbf49f
Author: Sepherosa Ziehau <sephe at>
Date:   Tue Oct 27 20:43:11 2015 +0800

    tcp: Use 4-tuple hash to optimize local port selection.
    So that the connection can:
    - Stay in the current netisr to avoid connection forwarding.
    - Use the portinfo of the target netisr to avoid portinfo
      contention, if connection forwarding could not be avoided,
      e.g. when the ports of current netisr are depleted.
    And don't try too hard to perform this local port selection
    optimization (it's relative time consuming).  Number of tries
    for this optimized local port selection is controlled by sysctl
    node net.inet.ip.porthash_trycount (15 by default).  Setting
    this sysctl node to 0 will disable this local port selection
    Total IPI rate and MP collision rate is significantly reduced,
    when tools/kq_connect_client runs @395Kconns/s:
    - Total IPI rate is reduced by 64K/s (421K/s -> 357K/s).
    - Total MP collision rate is reduced by 81K/s (310K/s -> 229K/s).

Summary of changes:
 sys/netinet/in_pcb.c | 57 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 49 insertions(+), 8 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list