git: 312f5f8a4fb9 - main - altq: mark callouts as mpsafe

Kristof Provost kp at FreeBSD.org
Sat Sep 4 18:46:13 UTC 2021


The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=312f5f8a4fb92c46b5499139b48cf525a4049243

commit 312f5f8a4fb92c46b5499139b48cf525a4049243
Author:     Kristof Provost <kp at FreeBSD.org>
AuthorDate: 2021-09-04 12:18:45 +0000
Commit:     Kristof Provost <kp at FreeBSD.org>
CommitDate: 2021-09-04 15:26:10 +0000

    altq: mark callouts as mpsafe
    
    There's no reason to acquire the Giant lock while executing the ALTQ
    callouts.
    
    While here also remove a few backwards compatibility defines for long
    obsolete FreeBSD versions.
    
    Reviewed by:    mav
    Suggested by:   mav
    Differential Revision:  https://reviews.freebsd.org/D31835
---
 sys/net/altq/altq_subr.c | 4 +---
 sys/net/altq/altq_var.h  | 9 +--------
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c
index 39f91c4daf63..32999b694bcb 100644
--- a/sys/net/altq/altq_subr.c
+++ b/sys/net/altq/altq_subr.c
@@ -908,9 +908,7 @@ EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL,
 static void
 init_machclk_setup(void)
 {
-#if (__FreeBSD_version >= 600000)
-	callout_init(&tbr_callout, 0);
-#endif
+	callout_init(&tbr_callout, 1);
 
 	machclk_usepcc = 1;
 
diff --git a/sys/net/altq/altq_var.h b/sys/net/altq/altq_var.h
index f711e09334cb..6763fd972d7d 100644
--- a/sys/net/altq/altq_var.h
+++ b/sys/net/altq/altq_var.h
@@ -164,16 +164,9 @@ typedef u_long ioctlcmd_t;
 /* use callout */
 #include <sys/callout.h>
 
-#if (__FreeBSD_version > 500000)
-#define	CALLOUT_INIT(c)		callout_init((c), 0)
-#else
-#define	CALLOUT_INIT(c)		callout_init((c))
-#endif
+#define	CALLOUT_INIT(c)		callout_init((c), 1)
 #define	CALLOUT_RESET(c,t,f,a)	callout_reset((c),(t),(f),(a))
 #define	CALLOUT_STOP(c)		callout_stop((c))
-#if !defined(CALLOUT_INITIALIZER) && (__FreeBSD_version < 600000)
-#define	CALLOUT_INITIALIZER	{ { { NULL } }, 0, NULL, NULL, 0 }
-#endif
 
 #define	m_pktlen(m)		((m)->m_pkthdr.len)
 


More information about the dev-commits-src-main mailing list