diff options
author | jhb <jhb@FreeBSD.org> | 2011-12-02 19:59:46 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2011-12-02 19:59:46 +0000 |
commit | dd3857eae15e3d51ccac9a72fc595633e433179b (patch) | |
tree | ca23906b91a78fa881696053599c46f832dc69ba | |
parent | aad7cc1b2ba1cf7ea14ebbde55c0c489cbf1b571 (diff) | |
download | FreeBSD-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
-rw-r--r-- | sys/kern/kern_resource.c | 5 |
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); |