diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 98c4cf8182cf2a1712060d5106eaa9abb2d18344..4554cde2f6f96293be4636fb6e191f3dc0d98096 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;