* [PATCH] setscheduler resched bug
@ 2003-05-21 20:40 Joe Korty
0 siblings, 0 replies; only message in thread
From: Joe Korty @ 2003-05-21 20:40 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel
setscheduler is not forcing a reschedule when needed like set_user_nice
does. It should.
Joe
--- 2.5.69/kernel/sched.c.orig 2003-05-21 14:50:53.000000000 -0400
+++ 2.5.69/kernel/sched.c 2003-05-21 15:01:13.000000000 -0400
@@ -1716,6 +1716,7 @@
unsigned long flags;
runqueue_t *rq;
task_t *p;
+ int oldprio;
if (!param || pid < 0)
goto out_nounlock;
@@ -1778,12 +1779,20 @@
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 on a CPU and the priority dropped, or not on
+ * a CPU and the priority rose above the currently running task.
+ */
+ if ((rq->curr == p) ? (p->prio > oldprio) : (p->prio < rq->curr->prio))
+ resched_task(rq->curr);
+ }
out_unlock:
task_rq_unlock(rq, &flags);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-05-21 20:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-21 20:40 [PATCH] setscheduler resched bug Joe Korty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®