Thread (63 messages) 63 messages, 4 authors, 2016-01-22

Re: [RFC V2 2/2] sched: idle: IRQ based next prediction for idle period

From: Peter Zijlstra <peterz@infradead.org>
Date: 2016-01-20 19:40:16
Also in: lkml

On Wed, Jan 20, 2016 at 05:00:33PM +0100, Daniel Lezcano wrote:
+static inline u32 stats_mean(struct stats *s)
+{
+	/*
+	 * gcc is smart enough to convert to a bits shift when the
+	 * divisor is constant and multiple of 2^x.
+	 *
+	 * The number of values could have not reached STATS_NR_VALUES
+	 * yet, but we can consider it acceptable as the situation is
+	 * only at the beginning of the burst of irqs.
+	 */
+	return s->sum / STATS_NR_VALUES;
+}
Note that ->sum is u64, so you're very prone to truncation.


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help