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/sched_ule.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/sched_ule.c')
-rw-r--r-- | sys/kern/sched_ule.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 030c98d..fb30fdb 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1677,8 +1677,8 @@ sched_user_prio(struct thread *td, u_char prio) { td->td_base_user_pri = prio; - if (td->td_flags & TDF_UBORROWING && td->td_user_pri <= prio) - return; + if (td->td_lend_user_pri <= prio) + return; td->td_user_pri = prio; } @@ -1687,8 +1687,10 @@ sched_lend_user_prio(struct thread *td, u_char prio) { THREAD_LOCK_ASSERT(td, MA_OWNED); - td->td_flags |= TDF_UBORROWING; - td->td_user_pri = prio; + if (prio < td->td_lend_user_pri) + td->td_lend_user_pri = prio; + if (prio < td->td_user_pri) + td->td_user_pri = prio; } void @@ -1698,12 +1700,11 @@ sched_unlend_user_prio(struct thread *td, u_char prio) THREAD_LOCK_ASSERT(td, MA_OWNED); base_pri = td->td_base_user_pri; - if (prio >= base_pri) { - td->td_flags &= ~TDF_UBORROWING; - sched_user_prio(td, base_pri); - } else { - sched_lend_user_prio(td, prio); - } + td->td_lend_user_pri = prio; + if (prio > base_pri) + td->td_user_pri = base_pri; + else + td->td_user_pri = prio; } /* |