On Mon, Feb 17, 2014 at 11:31:16AM +0800, Michael wang wrote:
> >  pick_next_task(struct rq *rq, struct task_struct *prev)
> >  {
> > -   const struct sched_class *class;
> > +   const struct sched_class *class = &fair_sched_class;
> >     struct task_struct *p;
> > 
> >     /*
> >      * Optimization: we know that if all tasks are in
> >      * the fair class we can call that function directly:
> >      */
> > -   if (likely(prev->sched_class == &fair_sched_class &&
> > +   if (likely(prev->sched_class == class &&
> >                rq->nr_running == rq->cfs.h_nr_running)) {
> >             p = fair_sched_class.pick_next_task(rq, prev);
> >             if (likely(p))
> > -                   return p;
> > +                   goto got_task;
> 
> Since idle_balance() won't happen in the loop, may be we could use:
> 
>       if p && p->sched_class == class
>               return p
> 
> in here, let it fall down into the loop if p is idle, since that means
> we got RT/DL and will do this anyway, could save two jump work may be?
> (and may could combine some code below if so?)

Maybe; we'd have to look at whatever GCC does with it. But yes I think I
like the code better that way.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to