[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.02.1401241218470.16419@file01.intranet.prod.int.rdu2.redhat.com>
Date: Fri, 24 Jan 2014 12:21:32 -0500 (EST)
From: Mikulas Patocka <mpatocka@...hat.com>
To: John Stultz <johnstul@...ibm.com>,
Thomas Gleixner <tglx@...utronix.de>
cc: linux-kernel@...r.kernel.org
Subject: [PATCH] Fix overflow when HZ is smaller than 60
When compiling for the IA-64 ski emulator, HZ is set to 32 because the
emulation is slow and we don't want to waste too many cycles processing
timers. Alpha also has an option to set HZ to 32.
This causes integer underflow in
kernel/time/jiffies.c:
kernel/time/jiffies.c:66:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
.mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
^
This patch reduces the JIFFIES_SHIFT value to avoid the overflow.
Signed-off-by: Mikulas Patocka <mikulas@...ax.karlin.mff.cuni.cz>
Cc: stable@...r.kernel.org
---
kernel/time/jiffies.c | 6 ++++++
1 file changed, 6 insertions(+)
Index: linux-2.6-ia64/kernel/time/jiffies.c
===================================================================
--- linux-2.6-ia64.orig/kernel/time/jiffies.c 2014-01-24 17:48:48.000000000 +0100
+++ linux-2.6-ia64/kernel/time/jiffies.c 2014-01-24 18:14:51.000000000 +0100
@@ -51,7 +51,13 @@
* HZ shrinks, so values greater than 8 overflow 32bits when
* HZ=100.
*/
+#if HZ < 30
+#define JIFFIES_SHIFT 6
+#elif HZ < 60
+#define JIFFIES_SHIFT 7
+#else
#define JIFFIES_SHIFT 8
+#endif
static cycle_t jiffies_read(struct clocksource *cs)
{
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists