Commit 6d1cafd8 authored by Venkatesh Pallipadi's avatar Venkatesh Pallipadi Committed by Ingo Molnar

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: default avatarVenkatesh Pallipadi <venki@google.com>
Reviewed-by: default avatarRik van Riel <riel@redhat.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1299025701-22168-1-git-send-email-venki@google.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent c02aa73b
...@@ -5522,8 +5522,15 @@ bool __sched yield_to(struct task_struct *p, bool preempt) ...@@ -5522,8 +5522,15 @@ bool __sched yield_to(struct task_struct *p, bool preempt)
goto out; goto out;
yielded = curr->sched_class->yield_to_task(rq, p, preempt); yielded = curr->sched_class->yield_to_task(rq, p, preempt);
if (yielded) if (yielded) {
schedstat_inc(rq, yld_count); 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: out:
double_rq_unlock(rq, p_rq); double_rq_unlock(rq, p_rq);
......
...@@ -1987,10 +1987,6 @@ static bool yield_to_task_fair(struct rq *rq, struct task_struct *p, bool preemp ...@@ -1987,10 +1987,6 @@ static bool yield_to_task_fair(struct rq *rq, struct task_struct *p, bool preemp
/* Tell the scheduler that we'd really like pse to run next. */ /* Tell the scheduler that we'd really like pse to run next. */
set_next_buddy(se); set_next_buddy(se);
/* Make p's CPU reschedule; pick_next_entity takes care of fairness. */
if (preempt)
resched_task(rq->curr);
yield_task_fair(rq); yield_task_fair(rq);
return true; return true;
......
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