Wrap propagate_priority() in a critical section to prevent unwanted

preemptions when adjusting the priority of a thread that is on a run
queue.  This was only observed when FULL_PREEMPTION was enabled.

Reported by:	kris
Diagnosed by:	ups
MFC after:	1 week
This commit is contained in:
John Baldwin 2007-01-11 19:13:27 +00:00
parent eb15e82311
commit 19c80b2652

View File

@ -421,7 +421,9 @@ turnstile_adjust(struct thread *td, u_char oldpri)
if (td == TAILQ_FIRST(&ts->ts_blocked[td->td_tsqueue]) &&
td->td_priority < oldpri) {
mtx_unlock_spin(&tc->tc_lock);
critical_enter();
propagate_priority(td);
critical_exit();
} else
mtx_unlock_spin(&tc->tc_lock);
}
@ -676,7 +678,9 @@ turnstile_wait(struct lock_object *lock, struct thread *owner, int queue)
td->td_blocked = ts;
td->td_lockname = lock->lo_name;
TD_SET_LOCK(td);
critical_enter();
propagate_priority(td);
critical_exit();
if (LOCK_LOG_TEST(lock, 0))
CTR4(KTR_LOCK, "%s: td %d blocked on [%p] %s", __func__,