Index | Thread | Search

From:
Alexander Bluhm <alexander.bluhm@gmx.net>
Subject:
tcp timer without kernel lock
To:
tech@openbsd.org
Date:
Mon, 29 Jan 2024 23:22:04 +0100

Download raw body.

Thread
Hi

TCP timers are protected by exclusive net lock.  There is not reason
for them to hold kernel lock.  Now that we have MP safe timeout,
we can convert them.

ok?

bluhm

Index: netinet/tcp_timer.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_timer.h,v
diff -u -p -r1.20 tcp_timer.h
--- netinet/tcp_timer.h	14 Mar 2023 00:24:05 -0000	1.20
+++ netinet/tcp_timer.h	29 Jan 2024 13:38:14 -0000
@@ -117,7 +117,9 @@ const char *tcptimers[TCPT_NTIMERS] =
  * Init, arm, disarm, and test TCP timers.
  */
 #define	TCP_TIMER_INIT(tp, timer)					\
-	timeout_set_proc(&(tp)->t_timer[(timer)], tcp_timer_funcs[(timer)], tp)
+	timeout_set_flags(&(tp)->t_timer[(timer)],			\
+	    tcp_timer_funcs[(timer)], tp, KCLOCK_NONE, 			\
+	    TIMEOUT_PROC | TIMEOUT_MPSAFE)
 
 #define	TCP_TIMER_ARM(tp, timer, msecs)					\
 do {									\