Messages in this thread | | | Date | Mon, 17 Feb 2014 12:24:20 +0100 | From | Peter Zijlstra <> | Subject | Re: [RFC PATCH] sched: make sure sched-priority after invoke idle_balance() |
| |
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.
| |