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