summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_resource.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-12-02 19:59:46 +0000
committerjhb <jhb@FreeBSD.org>2011-12-02 19:59:46 +0000
commitdd3857eae15e3d51ccac9a72fc595633e433179b (patch)
treeca23906b91a78fa881696053599c46f832dc69ba /sys/kern/kern_resource.c
parentaad7cc1b2ba1cf7ea14ebbde55c0c489cbf1b571 (diff)
downloadFreeBSD-src-dd3857eae15e3d51ccac9a72fc595633e433179b.zip
FreeBSD-src-dd3857eae15e3d51ccac9a72fc595633e433179b.tar.gz
When changing the user priority of a thread, change the real priority
in addition to the user priority for threads whose current real priority is equal to the previous user priority or if the new priority is a real-time priority. This allows priority changes of other threads to have an immediate effect. MFC after: 2 weeks
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r--sys/kern/kern_resource.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 0a36772..cccb040 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -488,8 +488,9 @@ rtp_to_pri(struct rtprio *rtp, struct thread *td)
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 */
+ if (td->td_user_pri != oldpri && (td == curthread ||
+ td->td_priority == oldpri || td->td_user_pri >= PRI_MAX_REALTIME))
+ sched_prio(td, td->td_user_pri);
if (TD_ON_UPILOCK(td) && oldpri != newpri) {
critical_enter();
thread_unlock(td);
OpenPOWER on IntegriCloud