setschedule() needs to force a reschedule in some situations. kernel/sched.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletion(-) diff -urN linux-2.5.72/kernel/sched.c linux/kernel/sched.c --- linux-2.5.72/kernel/sched.c 2003-06-16 21:20:20.000000000 -0700 +++ linux/kernel/sched.c 2003-06-17 13:44:15.509894276 -0700 @@ -1691,6 +1691,7 @@ { struct sched_param lp; int retval = -EINVAL; + int oldprio; prio_array_t *array; unsigned long flags; runqueue_t *rq; @@ -1757,12 +1758,24 @@ retval = 0; p->policy = policy; p->rt_priority = lp.sched_priority; + oldprio = p->prio; if (policy != SCHED_NORMAL) p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority; else p->prio = p->static_prio; - if (array) + if (array) { __activate_task(p, task_rq(p)); + /* + * Reschedule if we are currently running on this runqueue and + * our priority decreased, or if we are not currently running on + * this runqueue and our priority is higher than the current's + */ + if (rq->curr == p) { + if (p->prio > oldprio) + resched_task(rq->curr); + } else if (p->prio < rq->curr->prio) + resched_task(rq->curr); + } out_unlock: task_rq_unlock(rq, &flags);