6b782c
diff -ur sysstat-10.1.5.orig/common.c sysstat-10.1.5/common.c
6b782c
--- sysstat-10.1.5.orig/common.c	2013-03-23 17:31:46.000000000 +0100
6b782c
+++ sysstat-10.1.5/common.c	2014-09-01 22:29:48.173500407 +0200
6b782c
@@ -501,26 +501,13 @@
6b782c
 	hz = (unsigned int) ticks;
6b782c
 }
6b782c
 
6b782c
-/*
6b782c
- ***************************************************************************
6b782c
- * Handle overflow conditions properly for counters which are read as
6b782c
- * unsigned long long, but which can be unsigned long long or
6b782c
- * unsigned long only depending on the kernel version used.
6b782c
- * @value1 and @value2 being two values successively read for this
6b782c
- * counter, if @value2 < @value1 and @value1 <= 0xffffffff, then we can
6b782c
- * assume that the counter's type was unsigned long and has overflown, and
6b782c
- * so the difference @value2 - @value1 must be casted to this type.
6b782c
- * NOTE: These functions should no longer be necessary to handle a particular
6b782c
- * stat counter when we can assume that everybody is using a recent kernel
6b782c
- * (defining this counter as unsigned long long).
6b782c
- ***************************************************************************
6b782c
- */
6b782c
 double ll_sp_value(unsigned long long value1, unsigned long long value2,
6b782c
 		   unsigned long long itv)
6b782c
 {
6b782c
-	if ((value2 < value1) && (value1 <= 0xffffffff))
6b782c
-		/* Counter's type was unsigned long and has overflown */
6b782c
-		return ((double) ((value2 - value1) & 0xffffffff)) / itv * 100;
6b782c
+	/* Workaround: dyn-tick kernel has a race issue and /proc/stat values
6b782c
+	   could be backward. */
6b782c
+	if (value2 < value1)
6b782c
+		return (double) 0;
6b782c
 	else
6b782c
 		return SP_VALUE(value1, value2, itv);
6b782c
 }
6b782c
@@ -528,9 +515,10 @@
6b782c
 double ll_s_value(unsigned long long value1, unsigned long long value2,
6b782c
 		  unsigned long long itv)
6b782c
 {
6b782c
-	if ((value2 < value1) && (value1 <= 0xffffffff))
6b782c
-		/* Counter's type was unsigned long and has overflown */
6b782c
-		return ((double) ((value2 - value1) & 0xffffffff)) / itv * HZ;
6b782c
+	/* Workaround: dyn-tick kernel has a race issue and /proc/stat values
6b782c
+	   could be backward. */
6b782c
+	if (value2 < value1)
6b782c
+		return (double) 0;
6b782c
 	else
6b782c
 		return S_VALUE(value1, value2, itv);
6b782c
 }