git: ed998d1c24db - main - ithreads: Support priority adjustment by schedulers.

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

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

commit ed998d1c24dba600cf5fdf669370f1e2dfad3e47
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-07-14 20:13:35 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-07-14 20:13:35 +0000

    ithreads: Support priority adjustment by schedulers.
    
    Use sched_wakeup instead of sched_add when marking an ithread
    runnable.  This allows schedulers to reset their internal time slice
    tracking state and restore the base ithread priority when an ithread
    resumes from idle.
    
    Reviewed by:    markj
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D35643
---
 sys/kern/kern_intr.c    | 4 ++--
 sys/kern/kern_timeout.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index 693c5595ba31..3cd80f63704f 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -589,7 +589,7 @@ ithread_destroy(struct intr_thread *ithread)
 	ithread->it_flags |= IT_DEAD;
 	if (TD_AWAITING_INTR(td)) {
 		TD_CLR_IWAIT(td);
-		sched_add(td, SRQ_INTR);
+		sched_wakeup(td, SRQ_INTR);
 	} else
 		thread_unlock(td);
 }
@@ -1020,7 +1020,7 @@ intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame)
 		CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, td->td_proc->p_pid,
 		    td->td_name);
 		TD_CLR_IWAIT(td);
-		sched_add(td, SRQ_INTR);
+		sched_wakeup(td, SRQ_INTR);
 	} else {
 #ifdef HWPMC_HOOKS
 		it->it_waiting++;
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 621ea258f21c..23ddd03ae72e 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -559,7 +559,7 @@ next:
 			thread_lock_block_wait(td);
 			THREAD_LOCK_ASSERT(td, MA_OWNED);
 			TD_CLR_IWAIT(td);
-			sched_add(td, SRQ_INTR);
+			sched_wakeup(td, SRQ_INTR);
 		} else
 			mtx_unlock_spin_flags(&cc->cc_lock, MTX_QUIET);
 	} else