diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-12-29 09:26:46 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-12-29 09:26:46 +0000 |
commit | 3daac37e3cc9ba1161d9a56fb17bf021fe99aa16 (patch) | |
tree | 9d0be0ab5ff441a5fb794fbe642d219564ec4a4e /sys/kern/sched_4bsd.c | |
parent | 83176a34645a1df8d5383963324f71a7b7c3a195 (diff) | |
download | FreeBSD-src-3daac37e3cc9ba1161d9a56fb17bf021fe99aa16.zip FreeBSD-src-3daac37e3cc9ba1161d9a56fb17bf021fe99aa16.tar.gz |
- Follow r216313, the sched_unlend_user_prio is no longer needed, always
use sched_lend_user_prio to set lent priority.
- Improve pthread priority-inherit mutex, when a contender's priority is
lowered, repropagete priorities, this may cause mutex owner's priority
to be lowerd, in old code, mutex owner's priority is rise-only.
Diffstat (limited to 'sys/kern/sched_4bsd.c')
-rw-r--r-- | sys/kern/sched_4bsd.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 6278126..596102f 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -892,24 +892,12 @@ sched_lend_user_prio(struct thread *td, u_char prio) { THREAD_LOCK_ASSERT(td, MA_OWNED); - 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 -sched_unlend_user_prio(struct thread *td, u_char prio) -{ - u_char base_pri; - - THREAD_LOCK_ASSERT(td, MA_OWNED); - base_pri = td->td_base_user_pri; td->td_lend_user_pri = prio; - if (prio > base_pri) - td->td_user_pri = base_pri; - else - td->td_user_pri = prio; + td->td_user_pri = min(prio, td->td_base_user_pri); + if (td->td_priority > td->td_user_pri) + sched_prio(td, td->td_user_pri); + else if (td->td_priority != td->td_user_pri) + td->td_flags |= TDF_NEEDRESCHED; } void |