summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_ule.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2010-12-29 09:26:46 +0000
committerdavidxu <davidxu@FreeBSD.org>2010-12-29 09:26:46 +0000
commit3daac37e3cc9ba1161d9a56fb17bf021fe99aa16 (patch)
tree9d0be0ab5ff441a5fb794fbe642d219564ec4a4e /sys/kern/sched_ule.c
parent83176a34645a1df8d5383963324f71a7b7c3a195 (diff)
downloadFreeBSD-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_ule.c')
-rw-r--r--sys/kern/sched_ule.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index fb30fdb..a5a8d1b 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1687,24 +1687,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;
}
/*
OpenPOWER on IntegriCloud