|
@@ -2586,24 +2586,28 @@ static inline void schedule_debug(struct task_struct *prev)
|
|
|
static inline struct task_struct *
|
|
|
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))
|
|
|
+ if (likely(p && p != RETRY_TASK))
|
|
|
return p;
|
|
|
}
|
|
|
|
|
|
+again:
|
|
|
for_each_class(class) {
|
|
|
p = class->pick_next_task(rq, prev);
|
|
|
- if (p)
|
|
|
+ if (p) {
|
|
|
+ if (unlikely(p == RETRY_TASK))
|
|
|
+ goto again;
|
|
|
return p;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
BUG(); /* the idle class will always have a runnable task */
|