Re: [PATCH] sched: Check nr_running before calling pick_next_task in schedule().

From: Rakib Mullick
Date: Sat Jul 02 2011 - 00:37:59 EST


Hi Paul,

On Sat, Jul 2, 2011 at 8:23 AM, Paul Turner <pjt@xxxxxxxxxx> wrote:
> Hi Rakib,
>
> This doesn't strike me as a very good trade.
>
I'm not sure why. What am I missing here?

> It adds a branch to the case where we actually have work to save branches in
> the case when we're idle anyway?

Yes, right. We're adding a branch here. Is it a misuse of branch? As I
mentioned, idle_balance can fail (I think thats an unlikely case, that
why I've added a branch). In that case, we don't need to call
pick_next_task. Note, in pick_next_task there is a check for
'likely(rq->nr_running == rq->cfs.nr_running)' - by using this patch
that case will be more likely (which itself calls
fair_sched_class.pick_next_task directly - which is an optimization).
If calling fair_sched_class.pick_next_task in case of all tasks are
cfs task is being treat as an optimization then why, when we're idle
calling idle_sched_class.pick_next_task, won't be an optimization?

Thanks,
Rakib

>
> - Paul
>
--
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/