Re: [PATCH 3/5] sched: remove unlikely in pre_schedule_rt

Steven Rostedt
2009-03-25T05:25:00Z

On Wed, 25 Mar 2009, Steven Rostedt wrote:

> From: Steven Rostedt <rostedt@goodmis.org>
>
> Impact: clean up
>
> The annotated branch profiler shows that the unlikely used by
> pre_schedule_rt is always incorrect. This makes sense because in
> sched.c we have:
>
> if (prev->sched_class->pre_schedule)
> prev->sched_class->pre_schedule(rq, prev);
>
> And we are saying that prev is unlikely to be an rt task. This looks
> more like a likely candidate to me.

I forgot to add the profiler output:

correct incorrect % Function File Line
------- --------- - -------- ---- ----
0 2248 100 pre_schedule_rt sched_rt.c 1263

-- Steve

>
> Signed-off-by: Steven Rostedt <srostedt@redhat.com>
> ---
> kernel/sched_rt.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
> index bac1061..537af77 100644
> --- a/kernel/sched_rt.c
> +++ b/kernel/sched_rt.c
> @@ -1260,7 +1260,7 @@ static int pull_rt_task(struct rq *this_rq)
> static void pre_schedule_rt(struct rq *rq, struct task_struct *prev)
> {
> /* Try to pull RT tasks here if we lower this rq's prio */
> - if (unlikely(rt_task(prev)) && rq->rt.highest_prio > prev->prio)
> + if (rt_task(prev) && rq->rt.highest_prio > prev->prio)
> pull_rt_task(rq);
> }
>
> --
> 1.6.2
>
> --
>