summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorVenkatesh Pallipadi <venki@google.com>2011-03-02 01:28:21 +0100
committerIngo Molnar <mingo@elte.hu>2011-03-04 11:14:31 +0100
commit6d1cafd8b56ea726c10a5a104de57cc3ed8fa953 (patch)
tree638ba81859114b2bda8b4899cf73cc20a8a31553 /kernel
parentsched: Allow users with sufficient RLIMIT_NICE to change from SCHED_IDLE policy (diff)
downloadlinux-6d1cafd8b56ea726c10a5a104de57cc3ed8fa953.tar.xz
linux-6d1cafd8b56ea726c10a5a104de57cc3ed8fa953.zip
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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c9
-rw-r--r--kernel/sched_fair.c4
2 files changed, 8 insertions, 5 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index f3030709d826..61452e86c73b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -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);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 1438e13cf8be..3f7ec9e27ee1 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -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. */
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);
return true;