diff options
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 956383844116..3b31fc05a0f1 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -3287,10 +3287,15 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) | |||
3287 | struct task_struct *p; | 3287 | struct task_struct *p; |
3288 | 3288 | ||
3289 | /* | 3289 | /* |
3290 | * Optimization: we know that if all tasks are in | 3290 | * Optimization: we know that if all tasks are in the fair class we can |
3291 | * the fair class we can call that function directly: | 3291 | * call that function directly, but only if the @prev task wasn't of a |
3292 | * higher scheduling class, because otherwise those loose the | ||
3293 | * opportunity to pull in more work from other CPUs. | ||
3292 | */ | 3294 | */ |
3293 | if (likely(rq->nr_running == rq->cfs.h_nr_running)) { | 3295 | if (likely((prev->sched_class == &idle_sched_class || |
3296 | prev->sched_class == &fair_sched_class) && | ||
3297 | rq->nr_running == rq->cfs.h_nr_running)) { | ||
3298 | |||
3294 | p = fair_sched_class.pick_next_task(rq, prev, rf); | 3299 | p = fair_sched_class.pick_next_task(rq, prev, rf); |
3295 | if (unlikely(p == RETRY_TASK)) | 3300 | if (unlikely(p == RETRY_TASK)) |
3296 | goto again; | 3301 | goto again; |