OpenBSD Journal

MP-safe tcp_input() committed

Contributed by Peter N. M. Hansteen on from the faster packets, more cores dept.

As we saw recently in the Graphed and measured: running TCP input in parallel story, Alexander Bluhm (bluhm@) has been working on parallel TCP input, finally making tcp_input() MP-safe. This work has now been committed,

List:       openbsd-cvs
Subject:    CVS: cvs.openbsd.org: src
From:       Alexander Bluhm <bluhm () openbsd ! org>
Date:       2025-04-26 13:58:08
CVSROOT:	/cvs
Module name:	src
Changes by:	bluhm@cvs.openbsd.org	2025/04/26 07:58:08

Modified files:
	sys/netinet    : in_proto.c 
	sys/netinet6   : in6_proto.c 

Log message:
Run TCP input in parallel on multiple CPUs.
Mark the protocol input function tcp_input() as MP-safe.  Then it
is called directly from the IP deliver loop with shared net lock.
Do not enqueue TCP packets to wait for exclusive net lock.  This
results in more contention on the socket lock.  Throughput optimization
for that problem could be done later.

tested by Mark Patruck; OK mvs@

which in turn means it is now even really convenient to test for all of us running -current or jumping from snapshot to snapshot.

At this stage, this isn't employing optimised approach ("Column 2") discussed in the earlier article, because testing exposed problem(s).

Enjoy the even faster packets!


Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]