From: mvs Date: Fri, 1 Dec 2023 20:30:22 +0000 (+0000) Subject: pipex(4) layer is completely mp-safe, move the pipex_timer() timeout(9) X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=651f1b45a770aa26f1fbc833b81d0ae43021a533;p=openbsd pipex(4) layer is completely mp-safe, move the pipex_timer() timeout(9) handler out of kernel lock. ok bluhm --- diff --git a/sys/net/pipex.c b/sys/net/pipex.c index ac42168076b..299d1902a68 100644 --- a/sys/net/pipex.c +++ b/sys/net/pipex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.c,v 1.150 2023/11/28 13:23:20 bluhm Exp $ */ +/* $OpenBSD: pipex.c,v 1.151 2023/12/01 20:30:22 mvs Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -716,7 +716,8 @@ pipex_lookup_by_session_id(int protocol, int session_id) void pipex_timer_start(void) { - timeout_set_proc(&pipex_timer_ch, pipex_timer, NULL); + timeout_set_flags(&pipex_timer_ch, pipex_timer, NULL, + KCLOCK_NONE, TIMEOUT_PROC | TIMEOUT_MPSAFE); timeout_add_sec(&pipex_timer_ch, pipex_prune); } @@ -731,8 +732,6 @@ pipex_timer(void *ignored_arg) { struct pipex_session *session, *session_tmp; - timeout_add_sec(&pipex_timer_ch, pipex_prune); - mtx_enter(&pipex_list_mtx); /* walk through */ LIST_FOREACH_SAFE(session, &pipex_session_list, session_list, @@ -767,6 +766,9 @@ pipex_timer(void *ignored_arg) } } + if (LIST_FIRST(&pipex_session_list)) + timeout_add_sec(&pipex_timer_ch, pipex_prune); + mtx_leave(&pipex_list_mtx); }