sched: Check the right ->nr_running in yield_task_fair()
authorRik van Riel <riel@redhat.com>
Tue, 1 Feb 2011 14:47:15 +0000 (09:47 -0500)
committerIngo Molnar <mingo@elte.hu>
Thu, 3 Feb 2011 13:20:32 +0000 (14:20 +0100)
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>
kernel/sched_fair.c

index 55040f3938d8c31a22d190d1efe5306811096faa..4de9905228c4a4b6820d8064e7a177b8e0117f89 100644 (file)
@@ -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);