summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoonwoo Park <joonwoop@codeaurora.org>2014-12-16 14:44:09 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:01:23 -0700
commita4ca8c9b561213652950165170730375bbafbb98 (patch)
tree51825334ec1a80dce58997ec22df40c70c262424
parent790d5d8a4ad4309dfc44ca217fe073b1e51200c1 (diff)
sched: take account of irq preemption when calculating irqload delta
If irq raises while sched_irqload() is calculating irqload delta, sched_account_irqtime() can update rq's irqload_ts which can be greater than the jiffies stored in sched_irqload()'s context so delta can be negative. This negative delta means there was recent irq occurence. So remove improper BUG_ON(). CRs-fixed: 771894 Change-Id: I5bb01b50ec84c14bf9f26dd9c95de82ec2cd19b5 Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
-rw-r--r--kernel/sched/sched.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 2307b7cea12c..898e24e9f63d 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1039,7 +1039,12 @@ static inline u64 sched_irqload(int cpu)
s64 delta;
delta = get_jiffies_64() - rq->irqload_ts;
- BUG_ON(delta < 0);
+ /*
+ * Current context can be preempted by irq and rq->irqload_ts can be
+ * updated by irq context so that delta can be negative.
+ * But this is okay and we can safely return as this means there
+ * was recent irq occurrence.
+ */
if (delta < SCHED_HIGH_IRQ_TIMEOUT)
return rq->avg_irqload;