CVSROOT:        /cvs
Module name:    src
Changes by:     bl...@cvs.openbsd.org   2025/04/16 06:51:11

Modified files:
        sys/netinet    : tcp_input.c 

Log message:
Take socket lock in TCP input.

In preparation to run tcp_input() in parallel, the socket has to
be locked while processing incoming TCP packets.  After inpcb lookup,
in addition take the socket lock and increase the socket reference
counter.  The function in_pcbsolock_ref() upgrades a from a locked
inpcb to a locked socket by using mutex and refcount.  syn_cache_get()
unlocks the listen socket and returns a locked socket, syn_cache_add()
relies on socket lock.

With this commit, exclusive net lock is still held.  TCP thoughput
gets slower by 6% due to the additional mutex and refcount.  But I
want to see if locking and refcount works, before switching tcp_input()
to shared net lock.  Running TCP in parallel will more than compensate
the cost of locking.

tested as part of parallel TCP input by Mark Patruck, Hrvoje Popovski
OK mvs@

Reply via email to