2012-11-22 20:02:35

by Kirill Tkhai

[permalink] [raw]
Subject: [PATCH]sched/rt.c: Add reschedule to switched_from_rt()

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

Signed-off-by: Kirill V Tkhai <[email protected]>
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(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 418feb0..29bda5b 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -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)


2012-11-28 03:45:47

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH]sched/rt.c: Add reschedule to switched_from_rt()

On Fri, 2012-11-23 at 00:02 +0400, Kirill Tkhai wrote:
> Reschedule rq->curr if the first RT task has just been
> pulled to the rq.
>
> Signed-off-by: Kirill V Tkhai <[email protected]>
> 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(-)
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 418feb0..29bda5b 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -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.

Acked-by: Steven Rostedt <[email protected]>

-- Steve

> }
>
> void init_sched_rt_class(void)