Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce0cb029 authored by Joonwoo Park's avatar Joonwoo Park Committed by Matt Wagantall
Browse files

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: default avatarJoonwoo Park <joonwoop@codeaurora.org>
parent 6c352f2c
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -948,7 +948,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;