diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -205,7 +205,7 @@ sched_clear_tdname(td); #endif thread_lock(td); - sched_prio(td, pri); + sched_ithread_prio(td, pri); thread_unlock(td); } diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -391,7 +391,7 @@ cc->cc_thread = td; thread_lock(td); sched_class(td, PRI_ITHD); - sched_prio(td, PI_SOFTCLOCK); + sched_ithread_prio(td, PI_SOFTCLOCK); TD_SET_IWAIT(td); thread_lock_set(td, (struct mtx *)&cc->cc_lock); thread_unlock(td); diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -924,6 +924,15 @@ turnstile_adjust(td, oldprio); } +void +sched_ithread_prio(struct thread *td, u_char prio) +{ + THREAD_LOCK_ASSERT(td, MA_OWNED); + MPASS(td->td_pri_class == PRI_ITHD); + td->td_base_ithread_pri = prio; + sched_prio(td, prio); +} + void sched_user_prio(struct thread *td, u_char prio) { diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1962,6 +1962,18 @@ turnstile_adjust(td, oldprio); } +/* + * Set the base interrupt thread priority. + */ +void +sched_ithread_prio(struct thread *td, u_char prio) +{ + THREAD_LOCK_ASSERT(td, MA_OWNED); + MPASS(td->td_pri_class == PRI_ITHD); + td->td_base_ithread_pri = prio; + sched_prio(td, prio); +} + /* * Set the base user priority, does not effect current running priority. */ diff --git a/sys/kern/subr_busdma_bounce.c b/sys/kern/subr_busdma_bounce.c --- a/sys/kern/subr_busdma_bounce.c +++ b/sys/kern/subr_busdma_bounce.c @@ -439,7 +439,7 @@ thread_lock(curthread); sched_class(curthread, PRI_ITHD); - sched_prio(curthread, PI_SWI(SWI_BUSDMA)); + sched_ithread_prio(curthread, PI_SWI(SWI_BUSDMA)); thread_unlock(curthread); for (;;) { mtx_lock(&bounce_lock); diff --git a/sys/sys/proc.h b/sys/sys/proc.h --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -257,6 +257,7 @@ #define td_siglist td_sigqueue.sq_signals u_char td_lend_user_pri; /* (t) Lend user pri. */ u_char td_allocdomain; /* (b) NUMA domain backing this struct thread. */ + u_char td_base_ithread_pri; /* (t) Base ithread pri */ struct kmsan_td *td_kmsan; /* (k) KMSAN state */ /* Cleared during fork1() */ diff --git a/sys/sys/sched.h b/sys/sys/sched.h --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -95,6 +95,7 @@ void sched_exit_thread(struct thread *td, struct thread *child); u_int sched_estcpu(struct thread *td); void sched_fork_thread(struct thread *td, struct thread *child); +void sched_ithread_prio(struct thread *td, u_char prio); void sched_lend_prio(struct thread *td, u_char prio); void sched_lend_user_prio(struct thread *td, u_char pri); void sched_lend_user_prio_cond(struct thread *td, u_char pri);