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 @@ -981,15 +981,9 @@ 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: + if (td->td_lend_user_pri == prio) + return; + thread_lock(td); sched_lend_user_prio(td, prio); thread_unlock(td); 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 @@ -2007,15 +2007,9 @@ 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; + if (td->td_lend_user_pri == prio) + return; -lend: thread_lock(td); sched_lend_user_prio(td, prio); thread_unlock(td);