On Fri, Jan 17, 2014 at 10:04:04AM +0100, Daniel Lezcano wrote:
> @@ -2679,11 +2715,8 @@ need_resched:
>  
>       pre_schedule(rq, prev);
>  
> -     if (unlikely(!rq->nr_running))
> -             rq->idle_stamp = idle_balance(rq) ? 0 : rq_clock(rq);
> -
>       put_prev_task(rq, prev);
> -     next = pick_next_task(rq);
> +     next = pick_next_task_or_idle(rq);
>       clear_tsk_need_resched(prev);
>       clear_preempt_need_resched();
>       rq->skip_clock_update = 0;

I have vague memories that we need to have idle_balance() before
put_prev_task(), but I can't recollect why this would be so.

That said, if I resurrect these patches:

  https://lkml.org/lkml/2012/6/14/271

I suppose we could write something like:

struct task_struct *pick_next_task(struct rq *rq, struct task_struct *prev)
{
        const struct sched_class *class;
        struct task_struct *p;

again:
        if (likely(rq->nr_running)) {

                if (likely(rq->nr_running == rq->cfs.h_nr_running))
                        return fair_sched_class.pick_next_task(rq, prev);

                for_each_class(class) {
                        p = class->pick_next_task(rq, prev);
                        if (p)
                                return p;
                }
        }

        if (idle_balance(rq))
                goto again;

        rq->idle_stamp = rq_clock(rq);

        return idle_sched_class.pick_next_task(rq, prev);
}

Which keeps idle_balance() before put_prev_task(), and by using
idle_sched_clas.pick_next_task() doesn't rape the idle class interface
like you did :-)




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