Re: [RFC][PATCH 01/10] sched: Change rt_task(prev) in pre_schedule_rtto likely

From: Yong Zhang
Date: Mon Dec 06 2010 - 22:25:58 EST


On Tue, Dec 7, 2010 at 9:58 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> From: Steven Rostedt <srostedt@xxxxxxxxxx>
>
> As found with the branch annotation profiler, the unlikely(rt_task(prev))
> in pre_schedule_rt() is always wrong. In fact it should be likely due to
> the fact that we got to this function because we used prev's scheduling
> class (which had to be rt).
>
> Change the unlikely(rt_task(prev)) to likely(rt_task(prev))

I have sent a more radical patch before but it get ignored.
http://marc.info/?l=linux-kernel&m=126572702600950&w=2

>
> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> Cc: Gregory Haskins <ghaskins@xxxxxxxxxx>
> Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> ---
> Â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 bea7d79..7a5c4db 100644
> --- a/kernel/sched_rt.c
> +++ b/kernel/sched_rt.c
> @@ -1474,7 +1474,7 @@ skip:
> Â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.curr > prev->prio)
> + Â Â Â if (likely(rt_task(prev)) && rq->rt.highest_prio.curr > prev->prio)

IMHO, we can delete the checking for rt_task(prev).
Or am I missing something?

Thanks,
Yong
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/