summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_resource.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2007-12-11 08:25:36 +0000
committerdavidxu <davidxu@FreeBSD.org>2007-12-11 08:25:36 +0000
commit3695a7888976774d0e42b137f3ffa7d6f8aa6519 (patch)
treedb8a9074c62e65619a0ea9e604c0544a7ed3ac32 /sys/kern/kern_resource.c
parent50439b0991ca4d4578f2860fd70d8ac7a4e45adc (diff)
downloadFreeBSD-src-3695a7888976774d0e42b137f3ffa7d6f8aa6519.zip
FreeBSD-src-3695a7888976774d0e42b137f3ffa7d6f8aa6519.tar.gz
Fix LOR of thread lock and umtx's priority propagation mutex due
to the reworking of scheduler lock. MFC: after 3 days
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r--sys/kern/kern_resource.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 5086a59..4e22054 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <sys/syscallsubr.h>
#include <sys/sysent.h>
#include <sys/time.h>
+#include <sys/umtx.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -482,6 +483,7 @@ int
rtp_to_pri(struct rtprio *rtp, struct thread *td)
{
u_char newpri;
+ u_char oldpri;
if (rtp->prio > RTP_PRIO_MAX)
return (EINVAL);
@@ -501,10 +503,15 @@ rtp_to_pri(struct rtprio *rtp, struct thread *td)
return (EINVAL);
}
sched_class(td, rtp->type); /* XXX fix */
+ oldpri = td->td_user_pri;
sched_user_prio(td, newpri);
if (curthread == td)
sched_prio(curthread, td->td_user_pri); /* XXX dubious */
- thread_unlock(td);
+ if (TD_ON_UPILOCK(td) && oldpri != newpri) {
+ thread_unlock(td);
+ umtx_pi_adjust(td, oldpri);
+ } else
+ thread_unlock(td);
return (0);
}
OpenPOWER on IntegriCloud