From: Robert Love <rml@tech9.net>
To: Joe Korty <joe.korty@ccur.com>
Cc: george anzinger <george@mvista.com>,
"Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>,
"'Andrew Morton'" <akpm@digeo.com>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
"'mingo@elte.hu'" <mingo@elte.hu>, "Li, Adam" <adam.li@intel.com>
Subject: [patch] setscheduler fix
Date: 19 Jun 2003 10:45:33 -0700 [thread overview]
Message-ID: <1056044732.8770.39.camel@localhost> (raw)
In-Reply-To: <20030619171950.GA936@rudolph.ccur.com>
Here is my patch. It is the same idea as Joe's. Is there a better fix?
Basically, the problem is that setscheduler() does not set need_resched
when needed. There are two basic cases where this is needed:
- the task is running, but now it is no longer the highest
priority task on the rq
- the task is not running, but now it is the highest
priority task on the rq
In either case, we need to set need_resched to invoke the scheduler.
Patch is against 2.5.72. Comments?
Robert Love
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);
next prev parent reply other threads:[~2003-06-19 17:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-19 6:06 O(1) scheduler seems to lock up on sched_FIFO and sched_RR ta sks Perez-Gonzalez, Inaky
2003-06-19 6:07 ` Ingo Molnar
2003-06-19 16:00 ` george anzinger
2003-06-19 17:19 ` 'joe.korty@ccur.com'
2003-06-19 17:23 ` Robert Love
2003-06-19 17:28 ` Joe Korty
2003-06-19 17:45 ` Robert Love [this message]
2003-06-19 18:20 ` [patch] setscheduler fix Joe Korty
2003-06-19 18:38 ` Robert Love
2003-06-19 19:09 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2003-06-20 2:38 Perez-Gonzalez, Inaky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1056044732.8770.39.camel@localhost \
--to=rml@tech9.net \
--cc=adam.li@intel.com \
--cc=akpm@digeo.com \
--cc=george@mvista.com \
--cc=inaky.perez-gonzalez@intel.com \
--cc=joe.korty@ccur.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.