diff options
author | jhb <jhb@FreeBSD.org> | 2007-01-11 19:13:27 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2007-01-11 19:13:27 +0000 |
commit | 496f904eabc5a636f97ab8a3be7e8f10148b5a66 (patch) | |
tree | 2e9ff1da88cfa0913c9b18a3a5170a052c7389a5 /sys/kern/subr_turnstile.c | |
parent | fd81dffb5caf747b00bfd66e0706f69167812837 (diff) | |
download | FreeBSD-src-496f904eabc5a636f97ab8a3be7e8f10148b5a66.zip FreeBSD-src-496f904eabc5a636f97ab8a3be7e8f10148b5a66.tar.gz |
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
Diffstat (limited to 'sys/kern/subr_turnstile.c')
-rw-r--r-- | sys/kern/subr_turnstile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c index ec659ae..d451c07 100644 --- a/sys/kern/subr_turnstile.c +++ b/sys/kern/subr_turnstile.c @@ -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__, |