Add sched_ithread_prio to set the base priority of an interrupt thread.

Use it instead of sched_prio when setting the priority of an interrupt
thread.

Reviewed by:	kib, markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D35642
This commit is contained in:
John Baldwin 2022-07-14 13:13:10 -07:00
parent a985fad6e0
commit fea89a2804
7 changed files with 26 additions and 3 deletions

View File

@ -205,7 +205,7 @@ ithread_update(struct intr_thread *ithd)
sched_clear_tdname(td);
#endif
thread_lock(td);
sched_prio(td, pri);
sched_ithread_prio(td, pri);
thread_unlock(td);
}

View File

@ -391,7 +391,7 @@ start_softclock(void *dummy)
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);

View File

@ -924,6 +924,15 @@ sched_prio(struct thread *td, u_char prio)
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)
{

View File

@ -1962,6 +1962,18 @@ sched_prio(struct thread *td, u_char prio)
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.
*/

View File

@ -439,7 +439,7 @@ busdma_thread(void *dummy __unused)
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);

View File

@ -257,6 +257,7 @@ struct thread {
#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() */

View File

@ -95,6 +95,7 @@ void sched_ap_entry(void);
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);