Commit 9674f5ca authored by Viresh Kumar's avatar Viresh Kumar Committed by Ingo Molnar

sched/fair: Avoid checking cfs_rq->nr_running twice

Rearrange pick_next_task_fair() a bit to avoid checking
cfs_rq->nr_running twice for the case where FAIR_GROUP_SCHED is enabled
and the previous task doesn't belong to the fair class.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: linaro-kernel@lists.linaro.org
Link: http://lkml.kernel.org/r/000903ab3df3350943d3271c53615893a230dc95.1495603536.git.viresh.kumar@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent c7132dd6
...@@ -6187,10 +6187,10 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf ...@@ -6187,10 +6187,10 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
int new_tasks; int new_tasks;
again: again:
#ifdef CONFIG_FAIR_GROUP_SCHED
if (!cfs_rq->nr_running) if (!cfs_rq->nr_running)
goto idle; goto idle;
#ifdef CONFIG_FAIR_GROUP_SCHED
if (prev->sched_class != &fair_sched_class) if (prev->sched_class != &fair_sched_class)
goto simple; goto simple;
...@@ -6220,11 +6220,17 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf ...@@ -6220,11 +6220,17 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
/* /*
* This call to check_cfs_rq_runtime() will do the * This call to check_cfs_rq_runtime() will do the
* throttle and dequeue its entity in the parent(s). * throttle and dequeue its entity in the parent(s).
* Therefore the 'simple' nr_running test will indeed * Therefore the nr_running test will indeed
* be correct. * be correct.
*/ */
if (unlikely(check_cfs_rq_runtime(cfs_rq))) if (unlikely(check_cfs_rq_runtime(cfs_rq))) {
cfs_rq = &rq->cfs;
if (!cfs_rq->nr_running)
goto idle;
goto simple; goto simple;
}
} }
se = pick_next_entity(cfs_rq, curr); se = pick_next_entity(cfs_rq, curr);
...@@ -6264,12 +6270,8 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf ...@@ -6264,12 +6270,8 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
return p; return p;
simple: simple:
cfs_rq = &rq->cfs;
#endif #endif
if (!cfs_rq->nr_running)
goto idle;
put_prev_task(rq, prev); put_prev_task(rq, prev);
do { do {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment