mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
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>
This commit is contained in:
parent
50b926e439
commit
6d558c3ac9
1 changed files with 4 additions and 1 deletions
|
@ -5530,8 +5530,11 @@ asmlinkage void __sched schedule(void)
|
|||
|
||||
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())
|
||||
|
|
Loading…
Reference in a new issue