Skip to contentSkip to conversation

sched/rt.c: Add reschedule to switched_from_rt()

PATCH In review Kirill Tkhai 2 participants 3 messages Nov 22, 2012 – Jan 24, 2013 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/rt.c: Add reschedule to switched_from_rt()

Reschedule rq->curr if the first RT task has just been pulled to the rq.

CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
---
 kernel/sched/rt.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/sched/rt.c +5 -2
index 418feb0..29bda5b 100644
@@ -1889,8 +1889,11 @@ static void switched_from_rt(struct rq *rq, struct task_struct *p)
 	 * we may need to handle the pulling of RT tasks
 	 * now.
 	 */
-	if (p->on_rq && !rq->rt.rt_nr_running)
-		pull_rt_task(rq);
+	if (!p->on_rq || rq->rt.rt_nr_running)
+		return;
+
+	if (pull_rt_task(rq))
+		resched_task(rq->curr);
 }
 
 void init_sched_rt_class(void)
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Kirill Tkhai

Reschedule rq->curr if the first RT task has just been pulled to the rq.

CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
---
 kernel/sched/rt.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/sched/rt.c +0 -0
index 418feb0..29bda5b 100644

kernel/sched/rt.c static void switched_from_rt(struct rq *rq, struct task_struct *p) · line 1896

Quoted 10 lines
kernel/sched/rt.c +5 -2
@@ -1889,8 +1889,11 @@ static void switched_from_rt(struct rq *rq, struct task_struct *p)
 	 * we may need to handle the pulling of RT tasks
 	 * now.
 	 */
-	if (p->on_rq && !rq->rt.rt_nr_running)
-		pull_rt_task(rq);
+	if (!p->on_rq || rq->rt.rt_nr_running)
+		return;
+
+	if (pull_rt_task(rq))
+		resched_task(rq->curr);

Wow really? We never set NEED_RESCHED after pulling an RT task to a queue that is about to run SCHED_OTHER?

Hmm, this is usually called before switched_to(), and looking at switched_to_fair() there's a good chance that it does it.

But anyway, might as well add it here, I don't think it will hurt. The prio_changed_rt() does it.

-- Steve

Quoted 3 lines
kernel/sched/rt.c +0 -0
 }
 
 void init_sched_rt_class(void)
#2 lore raw

[tip:sched/core] sched/rt: Add reschedule check to switched_from_rt()

In reply to Kirill Tkhai
Commit-ID:  1158ddb55416855fd17abe3214298f736f00426a
Gitweb:     http://git.kernel.org/tip/1158ddb55416855fd17abe3214298f736f00426a
Author:     Kirill Tkhai <[email protected]>
AuthorDate: Fri, 23 Nov 2012 00:02:15 +0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 24 Jan 2013 17:14:30 +0100

sched/rt: Add reschedule check to switched_from_rt()

Reschedule rq->curr if the first RT task has just been pulled to the rq.

---
 kernel/sched/rt.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/sched/rt.c +5 -2
index 418feb0..29bda5b 100644
@@ -1889,8 +1889,11 @@ static void switched_from_rt(struct rq *rq, struct task_struct *p)
 	 * we may need to handle the pulling of RT tasks
 	 * now.
 	 */
-	if (p->on_rq && !rq->rt.rt_nr_running)
-		pull_rt_task(rq);
+	if (!p->on_rq || rq->rt.rt_nr_running)
+		return;
+
+	if (pull_rt_task(rq))
+		resched_task(rq->curr);
 }
 
 void init_sched_rt_class(void)