summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSrivatsa Vaddagiri <vatsa@codeaurora.org>2014-07-16 07:30:30 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 19:59:53 -0700
commit38e78bb4adbb2b67e4bb19e5dee2ea61c39e2abc (patch)
tree7fa951c554cdc9b6ef724e7c74ac73cac711e90f /kernel
parent961624dadc86491c45b87cce88d80d3465d6d764 (diff)
sched: Add BUG_ON when task_cpu() is incorrect
It would be fatal if task_cpu() information for a task does not accurately represent the cpu on which its running. All sorts of wierd issues can arise if that were to happen! Add a BUG_ON() in context switch to detect such cases. Change-Id: I4eb2c96c850e2247e22f773bbb6eedb8ccafa49c Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 65d61686ea84..41db511efbfd 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4053,6 +4053,8 @@ static void __sched notrace __schedule(bool preempt)
clear_preempt_need_resched();
rq->clock_skip_update = 0;
+ BUG_ON(task_cpu(next) != cpu_of(rq));
+
if (likely(prev != next)) {
rq->nr_switches++;
rq->curr = next;