From b1a3773d91a6df92e0ffd4805fc66ab93cbef0a8 Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 2 Dec 2011 19:59:46 +0000 Subject: [PATCH 64/65] 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 git-svn-id: http://svn.freebsd.org/base/head@228207 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f (cherry picked from commit e2101b6e2eec4d810f908c530171e9209e819ec0) Signed-off-by: Xin Li --- 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 d440e76..09c1d30 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -496,8 +496,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); -- 1.7.8.3