diff options
author | John Baldwin <jhb@FreeBSD.org> | 2007-01-11 19:13:27 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2007-01-11 19:13:27 +0000 |
commit | 19c80b2652b97b7e668df2b998ec06c414b35a1b (patch) | |
tree | 2e9ff1da88cfa0913c9b18a3a5170a052c7389a5 /sys/kern/subr_turnstile.c | |
parent | eb15e82311f282ccad6188fcaacc393f484bae5c (diff) | |
download | src-19c80b2652b97b7e668df2b998ec06c414b35a1b.tar.gz src-19c80b2652b97b7e668df2b998ec06c414b35a1b.zip |
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
Notes
Notes:
svn path=/head/; revision=165946
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 ec659aeeabff..d451c079b303 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__, |