summaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2015-09-29 12:18:46 +0200
committerIngo Molnar <mingo@kernel.org>2015-10-06 17:08:20 +0200
commite2bf1c4b17aff25f07e0d2952d8c1c66643f33fe (patch)
tree0fb449a9ea119b59e74d20608c1e0be1a5dd707b /kernel/sched
parent499d79559ffe4b9c0c3031752f6a40abd532fb75 (diff)
downloadlinux-stable-e2bf1c4b17aff25f07e0d2952d8c1c66643f33fe.tar.gz
linux-stable-e2bf1c4b17aff25f07e0d2952d8c1c66643f33fe.tar.bz2
linux-stable-e2bf1c4b17aff25f07e0d2952d8c1c66643f33fe.zip
sched/core: Add preempt_count invariant check
Ingo requested I keep my debug check for the preempt_count invariant. Requested-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 98c4cf8182cf..4554cde2f6f9 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2514,6 +2514,10 @@ static struct rq *finish_task_switch(struct task_struct *prev)
*
* Also, see FORK_PREEMPT_COUNT.
*/
+ if (WARN_ONCE(preempt_count() != 2*PREEMPT_DISABLE_OFFSET,
+ "corrupted preempt_count: %s/%d/0x%x\n",
+ current->comm, current->pid, preempt_count()))
+ preempt_count_set(FORK_PREEMPT_COUNT);
rq->prev_mm = NULL;