git: 2cf7870864ea - main - Collapse interrupt thread priorities.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 14 Jul 2022 20:15:39 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=2cf7870864ea7ca753190c9fe8abf36985d601d6

commit 2cf7870864ea7ca753190c9fe8abf36985d601d6
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-07-14 20:14:33 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-07-14 20:14:33 +0000

    Collapse interrupt thread priorities.
    
    Allow high priority hardware interrupts to run at PI_REALTIME via
    INTR_TYPE_CLK, but collapse all other hardware interrupt threads to
    the next priority level (PI_INTR).  Collapse all SWI priorities to
    the same priority level (PI_SOFT) just below PI_INTR.
    
    Reviewed by:    kib, markj
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D35646
---
 sys/kern/kern_intr.c | 16 ++--------------
 sys/sys/interrupt.h  |  4 ++--
 sys/sys/priority.h   | 21 +++++++++++++--------
 3 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index 3cd80f63704f..3c4f9d0eac23 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -1491,20 +1491,8 @@ db_dump_intrhand(struct intr_handler *ih)
 	case PI_REALTIME:
 		db_printf("CLK ");
 		break;
-	case PI_AV:
-		db_printf("AV  ");
-		break;
-	case PI_TTY:
-		db_printf("TTY ");
-		break;
-	case PI_NET:
-		db_printf("NET ");
-		break;
-	case PI_DISK:
-		db_printf("DISK");
-		break;
-	case PI_DULL:
-		db_printf("DULL");
+	case PI_INTR:
+		db_printf("INTR");
 		break;
 	default:
 		if (ih->ih_pri >= PI_SOFT)
diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h
index 09162469daed..ee4f07da1611 100644
--- a/sys/sys/interrupt.h
+++ b/sys/sys/interrupt.h
@@ -138,8 +138,8 @@ struct intr_event {
 #define	SWI_DELAY	0x2
 
 /*
- * Software interrupt numbers in priority order.  The priority determines
- * the priority of the corresponding interrupt thread.
+ * Software interrupt numbers.  Historically this was used to determine
+ * the relative priority of SWI ithreads.
  */
 #define	SWI_TTY		0
 #define	SWI_NET		1
diff --git a/sys/sys/priority.h b/sys/sys/priority.h
index 428be2d02c68..8fbb9b03f77f 100644
--- a/sys/sys/priority.h
+++ b/sys/sys/priority.h
@@ -85,15 +85,20 @@
 #define	PRI_MIN_ITHD		(PRI_MIN)
 #define	PRI_MAX_ITHD		(PRI_MIN_REALTIME - 1)
 
+/*
+ * Most hardware interrupt threads run at the same priority, but can
+ * decay to lower priorities if they run for full time slices.
+ */
 #define	PI_REALTIME		(PRI_MIN_ITHD + 0)
-#define	PI_AV			(PRI_MIN_ITHD + 4)
-#define	PI_SOFTCLOCK		PI_AV
-#define	PI_NET			(PRI_MIN_ITHD + 8)
-#define	PI_DISK			(PRI_MIN_ITHD + 12)
-#define	PI_TTY			(PRI_MIN_ITHD + 16)
-#define	PI_DULL			(PRI_MIN_ITHD + 20)
-#define	PI_SOFT			(PRI_MIN_ITHD + 24)
-#define	PI_SWI(x)		(PI_SOFT + (x) * RQ_PPQ)
+#define	PI_INTR			(PRI_MIN_ITHD + 4)
+#define	PI_AV			PI_INTR
+#define	PI_NET			PI_INTR
+#define	PI_DISK			PI_INTR
+#define	PI_TTY			PI_INTR
+#define	PI_DULL			PI_INTR
+#define	PI_SOFT			(PRI_MIN_ITHD + 8)
+#define	PI_SOFTCLOCK		PI_SOFT
+#define	PI_SWI(x)		PI_SOFT
 
 #define	PRI_MIN_REALTIME	(48)
 #define	PRI_MAX_REALTIME	(PRI_MIN_KERN - 1)