lkml.org 
[lkml]   [2014]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.



\
 
 \ /
  Last update: 2014-02-17 12:41    [W:0.064 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site