lkml.org 
[lkml]   [2010]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] sched: reassign prev and switch_count when reacquire_kernel_lock() fail
From
From 4c04fbbd43f3fef7a3b9471a0000c399c2e045ed Mon Sep 17 00:00:00 2001
From: Yong Zhang <yong.zhang0@gmail.com>
Date: Mon, 11 Jan 2010 14:21:25 +0800
Subject: [PATCH] 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>
---
kernel/sched.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index c535cc4..4508fe7 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5530,8 +5530,11 @@ need_resched_nonpreemptible:

post_schedule(rq);

- if (unlikely(reacquire_kernel_lock(current) < 0))
+ if (unlikely(reacquire_kernel_lock(current) < 0)) {
+ prev = rq->curr;
+ switch_count = &prev->nivcsw;
goto need_resched_nonpreemptible;
+ }

preempt_enable_no_resched();
if (need_resched())
--
1.6.3.3

\
 
 \ /
  Last update: 2010-01-11 07:41    [W:0.044 / U:24.392 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site