sched: Resched proper CPU on yield_to()

yield_to_task_fair() has code to resched the CPU of yielding task when the
intention is to resched the CPU of the task that is being yielded to.

Change here fixes the problem and also makes the resched conditional on
rq != p_rq.

Signed-off-by: Venkatesh Pallipadi <venki@google.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1299025701-22168-1-git-send-email-venki@google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Venkatesh Pallipadi
2011-03-01 16:28:21 -08:00
committed by Ingo Molnar
parent c02aa73b1d
commit 6d1cafd8b5
2 changed files with 8 additions and 5 deletions

View File

@@ -5522,8 +5522,15 @@ again:
goto out;
yielded = curr->sched_class->yield_to_task(rq, p, preempt);
if (yielded)
if (yielded) {
schedstat_inc(rq, yld_count);
/*
* Make p's CPU reschedule; pick_next_entity takes care of
* fairness.
*/
if (preempt && rq != p_rq)
resched_task(p_rq->curr);
}
out:
double_rq_unlock(rq, p_rq);