aboutsummaryrefslogtreecommitdiffstats
path: root/patches/linux-2.6.16.33/fix-hz-suspend.patch
blob: 2a964ccb8ceec9ec2db5ba429f7f05e32c3cd257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff -pruN ../orig-linux-2.6.16.29/kernel/timer.c ./kernel/timer.c
--- ../orig-linux-2.6.16.29/kernel/timer.c	2006-09-12 19:02:10.000000000 +0100
+++ ./kernel/timer.c	2006-09-19 13:58:58.000000000 +0100
@@ -555,6 +555,22 @@ found:
 	}
 	spin_unlock(&base->t_base.lock);
 
+	/*
+	 * It can happen that other CPUs service timer IRQs and increment
+	 * jiffies, but we have not yet got a local timer tick to process
+	 * the timer wheels.  In that case, the expiry time can be before
+	 * jiffies, but since the high-resolution timer here is relative to
+	 * jiffies, the default expression when high-resolution timers are
+	 * not active,
+	 *
+	 *   time_before(MAX_JIFFY_OFFSET + jiffies, expires)
+	 *
+	 * would falsely evaluate to true.  If that is the case, just
+	 * return jiffies so that we can immediately fire the local timer
+	 */
+	if (time_before(expires, jiffies))
+		return jiffies;
+
 	if (time_before(hr_expires, expires))
 		return hr_expires;