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

Peter Zijlstra
2011-07-02T15:35:43Z

On Sat, 2011-07-02 at 20:26 +0600, Rakib Mullick wrote:
> Well, yes - branching seems definitely have some side effects.

It adds the cost of the test as well as a possible branch mis-predict.

> Thinking from UP's perspective, it will only hit slow path -- going
> into idle.

Uhm, no, every time the machine is busy and does a schedule between
tasks you still get to do that extra nr_running test and branch.

> In that case, that likely branch will just fail. And on an
> UP system that slow path -- going into idle -- is the only way, taking
> the fast path (trying picking a task) isn't the right thing, isn't
> it?

I'm not at all sure I even understand what you're trying to say. I
really don't understand what's the problem with going the long way with
picking the idle task, the machine is idle, it doesn't have anything
useful to do, who cares.