aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong Zhang <yong.zhang0@gmail.com>2010-01-11 01:21:25 -0500
committerIngo Molnar <mingo@elte.hu>2010-01-21 07:39:04 -0500
commit6d558c3ac9b6508d26fd5cadccce51fc9d726b1c (patch)
treedbad2aa9c5874ea7ee5fff1f9f32b0be208c3df6
parent50b926e439620c469565e8be0f28be78f5fca1ce (diff)
sched: Reassign prev and switch_count when reacquire_kernel_lock() fail
Assume A->B schedule is processing, if B have acquired BKL before and it need reschedule this time. Then on B's context, it will go to need_resched_nonpreemptible for reschedule. But at this time, prev and switch_count are related to A. It's wrong and will lead to incorrect scheduler statistics. Signed-off-by: Yong Zhang <yong.zhang0@gmail.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <2674af741001102238w7b0ddcadref00d345e2181d11@mail.gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--kernel/sched.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index c535cc4f6428..4508fe7048be 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5530,8 +5530,11 @@ need_resched_nonpreemptible:
5530 5530
5531 post_schedule(rq); 5531 post_schedule(rq);
5532 5532
5533 if (unlikely(reacquire_kernel_lock(current) < 0)) 5533 if (unlikely(reacquire_kernel_lock(current) < 0)) {
5534 prev = rq->curr;
5535 switch_count = &prev->nivcsw;
5534 goto need_resched_nonpreemptible; 5536 goto need_resched_nonpreemptible;
5537 }
5535 5538
5536 preempt_enable_no_resched(); 5539 preempt_enable_no_resched();
5537 if (need_resched()) 5540 if (need_resched())