Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/sched_ule.c
Show First 20 Lines • Show All 1,855 Lines • ▼ Show 20 Lines | sched_lend_user_prio(struct thread *td, u_char prio) | ||||
td->td_lend_user_pri = prio; | td->td_lend_user_pri = prio; | ||||
td->td_user_pri = min(prio, td->td_base_user_pri); | td->td_user_pri = min(prio, td->td_base_user_pri); | ||||
if (td->td_priority > td->td_user_pri) | if (td->td_priority > td->td_user_pri) | ||||
sched_prio(td, td->td_user_pri); | sched_prio(td, td->td_user_pri); | ||||
else if (td->td_priority != td->td_user_pri) | else if (td->td_priority != td->td_user_pri) | ||||
td->td_flags |= TDF_NEEDRESCHED; | td->td_flags |= TDF_NEEDRESCHED; | ||||
} | } | ||||
/* | |||||
* Like the above but first check if there is anything to do. | |||||
*/ | |||||
void | |||||
sched_lend_user_prio_cond(struct thread *td, u_char prio) | |||||
{ | |||||
if (td->td_lend_user_pri != prio) | |||||
goto lend; | |||||
if (td->td_user_pri != min(prio, td->td_base_user_pri)) | |||||
goto lend; | |||||
if (td->td_priority >= td->td_user_pri) | |||||
goto lend; | |||||
return; | |||||
lend: | |||||
thread_lock(td); | |||||
sched_lend_user_prio(td, prio); | |||||
thread_unlock(td); | |||||
} | |||||
#ifdef SMP | #ifdef SMP | ||||
/* | /* | ||||
* This tdq is about to idle. Try to steal a thread from another CPU before | * This tdq is about to idle. Try to steal a thread from another CPU before | ||||
* choosing the idle thread. | * choosing the idle thread. | ||||
*/ | */ | ||||
static void | static void | ||||
tdq_trysteal(struct tdq *tdq) | tdq_trysteal(struct tdq *tdq) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,203 Lines • Show Last 20 Lines |