[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140117152310.GK11314@laptop.programming.kicks-ass.net>
Date: Fri, 17 Jan 2014 16:23:10 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: mingo@...nel.org, linux-kernel@...r.kernel.org,
linaro-kernel@...ts.linaro.org, alex.shi@...aro.org
Subject: Re: [PATCH 4/4] sched: Idle task shortcut optimization
On Fri, Jan 17, 2014 at 04:06:45PM +0100, Daniel Lezcano wrote:
> >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 :-)
>
> But put_prev_task is called before pick_next_task, so idle_balance() is
> called after now, no ?
No, put_prev_task() is called by the pick_next_task() that returns a
task. So in the idle case above, the idle_sched_class.pick_next_task()
will do the required put_prev_task().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists