diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-12-09 02:42:02 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-12-09 02:42:02 +0000 |
commit | 171976dba2208151b69025bbf1a0b5f395ddf742 (patch) | |
tree | 55786772bf8f6d419f8a02f1838bde8b593e497f /sys/kern/kern_umtx.c | |
parent | 9eb44e2a50d42aea2650694312bacb8b83a22cc5 (diff) | |
download | FreeBSD-src-171976dba2208151b69025bbf1a0b5f395ddf742.zip FreeBSD-src-171976dba2208151b69025bbf1a0b5f395ddf742.tar.gz |
MFp4:
It is possible a lower priority thread lending priority to higher priority
thread, in old code, it is ignored, however the lending should always be
recorded, add field td_lend_user_pri to fix the problem, if a thread does
not have borrowed priority, its value is PRI_MAX.
MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_umtx.c')
-rw-r--r-- | sys/kern/kern_umtx.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 43570ce..e7b9b32 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -1407,17 +1407,19 @@ umtx_propagate_priority(struct thread *td) for (;;) { td = pi->pi_owner; - if (td == NULL) + if (td == NULL || td == curthread) return; MPASS(td->td_proc != NULL); MPASS(td->td_proc->p_magic == P_MAGIC); - if (UPRI(td) <= pri) - return; - thread_lock(td); - sched_lend_user_prio(td, pri); + if (td->td_lend_user_pri > pri) + sched_lend_user_prio(td, pri); + else { + thread_unlock(td); + break; + } thread_unlock(td); /* @@ -3587,8 +3589,8 @@ umtx_thread_cleanup(struct thread *td) pi->pi_owner = NULL; TAILQ_REMOVE(&uq->uq_pi_contested, pi, pi_link); } + mtx_unlock_spin(&umtx_lock); thread_lock(td); - td->td_flags &= ~TDF_UBORROWING; + sched_unlend_user_prio(td, PRI_MAX); thread_unlock(td); - mtx_unlock_spin(&umtx_lock); } |