mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched: update cpupri for runqueue when its priority changes
@ 2011-06-05  9:54 Hillf Danton
  2011-06-17  1:50 ` Steven Rostedt
  0 siblings, 1 reply; 9+ messages in thread
From: Hillf Danton @ 2011-06-05  9:54 UTC (permalink / raw)
  To: LKML
  Cc: Steven Rostedt, Mike Galbraith, Yong Zhang, Peter Zijlstra, Ingo Molnar

When the priority of runqueue changes, lower or higer, the info of cpupri
should be updated, in cases such as pick_next_task_rt() and switched_to_rt().

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---
 kernel/sched_rt.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 08e9374..9508168 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1158,6 +1158,8 @@ static struct task_struct
*pick_next_task_rt(struct rq *rq)
 	 * lock again later if there is no need to push
 	 */
 	rq->post_schedule = has_pushable_tasks(rq);
+
+	cpupri_set(&rq->rd->cpupri, rq->cpu, p == NULL ? MAX_RT_PRIO : p->prio);
 #endif

 	return p;
@@ -1673,6 +1675,8 @@ static void switched_to_rt(struct rq *rq, struct
task_struct *p)
 {
 	int check_resched = 1;

+	if (!p->on_rq)
+		return;
 	/*
 	 * If we are already running, then there's nothing
 	 * that needs to be done. But if we are not running
@@ -1680,7 +1684,7 @@ static void switched_to_rt(struct rq *rq, struct
task_struct *p)
 	 * If that current running task is also an RT task
 	 * then see if we can move to another run queue.
 	 */
-	if (p->on_rq && rq->curr != p) {
+	if (rq->curr != p) {
 #ifdef CONFIG_SMP
 		if (rq->rt.overloaded && push_rt_task(rq) &&
 		    /* Don't resched if we changed runqueues */
@@ -1690,6 +1694,11 @@ static void switched_to_rt(struct rq *rq,
struct task_struct *p)
 		if (check_resched && p->prio < rq->curr->prio)
 			resched_task(rq->curr);
 	}
+	else {
+#ifdef CONFIG_SMP
+		cpupri_set(&rq->rd->cpupri, rq->cpu, p->prio);
+#endif
+	}
 }

 /*

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-06-20 13:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-05  9:54 [PATCH] sched: update cpupri for runqueue when its priority changes Hillf Danton
2011-06-17  1:50 ` Steven Rostedt
2011-06-17 12:59   ` Hillf Danton
2011-06-17 14:34     ` Steven Rostedt
2011-06-17 14:56     ` Steven Rostedt
2011-06-18 14:54       ` Hillf Danton
2011-06-18 17:11         ` Steven Rostedt
2011-06-19  8:33           ` Hillf Danton
2011-06-20 13:20             ` Steven Rostedt

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®