FreeBSD/sys/kern/kern_umtx.c
/*
 * Propagate priority when a thread is blocked on POSIX
 * PI mutex.
 */
Propagate priority when a thread is blocked on POSIX
PI mutex.
Propagate priority when a thread is blocked on POSIX PI mutex .
static void
umtx_propagate_priority(struct thread *td)
{
	struct umtx_q *uq;
	struct umtx_pi *pi;
	int pri;
	mtx_assert(&umtx_lock, MA_OWNED);
	pri = UPRI(td);
	uq = td->td_umtxq;
	pi = uq->uq_pi_blocked;
	if (pi == NULL)
		return;
	if (umtx_pi_check_loop(pi))
		return;
	for (;;) {
		td = pi->pi_owner;
		if (td == NULL || td == curthread)
			return;
		MPASS(td->td_proc != NULL);
		MPASS(td->td_proc->p_magic == P_MAGIC);
		thread_lock(td);
		if (td->td_lend_user_pri > pri)
			sched_lend_user_prio(td, pri);
		else {
			thread_unlock(td);
			break;
		}
		thread_unlock(td);
		uq = td->td_umtxq;
		pi = uq->uq_pi_blocked;
		if (pi == NULL)
			break;
		umtx_pi_adjust_thread(pi, td);
	}
}
static void umtx_propagate_priority ( struct thread * td ) { struct umtx_q * uq ; struct umtx_pi * pi ; int pri ; mtx_assert ( & umtx_lock , MA_OWNED ) ; pri = UPRI ( td ) ; uq = td -> td_umtxq ; pi = uq -> uq_pi_blocked ; if ( pi == NULL ) return ; if ( umtx_pi_check_loop ( pi ) ) return ; for ( ; ; ) { td = pi -> pi_owner ; if ( td == NULL || td == curthread ) return ; MPASS ( td -> td_proc != NULL ) ; MPASS ( td -> td_proc -> p_magic == P_MAGIC ) ; thread_lock ( td ) ; if ( td -> td_lend_user_pri > pri ) sched_lend_user_prio ( td , pri ) ; else { thread_unlock ( td ) ; break ; } thread_unlock ( td ) ; uq = td -> td_umtxq ; pi = uq -> uq_pi_blocked ; if ( pi == NULL ) break ; umtx_pi_adjust_thread ( pi , td ) ; } }
Propagate priority when a thread is blocked on POSIX
 PI mutex.
Propagate priority when a thread is blocked on POSIX PI mutex .
/*
		 * Pick up the lock that td is blocked on.
		 */ /* Resort td on the list if needed. */