sched: minor optimization
Quoted 1 line
On Fri, Nov 23, 2007 at 5:48 PM, "Dmitry Adamushko"
Quoted 3 lines · <[email protected]> wrote:
The only legitimate possibility of having the
fair_sched_classreturning no task in this case is when 'rq->nr_running==rq->cfs.nr_running== 0'.
Yes, I think so.
Quoted 10 lines
iow, a possible optimization would be just the following check :
if (
rq->nr_running== 0)return idle_sched_class.pick_next_task(rq);at the beginning of
pick_next_task().(or maybe put it at the beginning of the
if (likely(rq->nr_running == rq->cfs.nr_running)) {} block as we already have 'likely()' there).
But that might add a test before the case we want to optimize the most. I just thought of taking advantage of a case where we know rq->nr_running==0, instead of throwing away that information.
Thanks
Nikanth