Skip to content

Commit

Permalink
sched: Check the right ->nr_running in yield_task_fair()
Browse files Browse the repository at this point in the history
With CONFIG_FAIR_GROUP_SCHED, each task_group has its own cfs_rq.
Yielding to a task from another cfs_rq may be worthwhile, since
a process calling yield typically cannot use the CPU right now.

Therefor, we want to check the per-cpu nr_running, not the
cgroup local one.

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20110201094715.798c4f86@annuminas.surriel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Rik van Riel authored and Ingo Molnar committed Feb 3, 2011
1 parent 6ea72f1 commit 725e758
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ static void yield_task_fair(struct rq *rq)
/*
* Are we the only task in the tree?
*/
if (unlikely(cfs_rq->nr_running == 1))
if (unlikely(rq->nr_running == 1))
return;

clear_buddies(cfs_rq, se);
Expand Down

0 comments on commit 725e758

Please sign in to comment.