ia64/xen-unstable

changeset 10599:18f8dde91fbd

Replace my previous patch with equivalent fix from linux-2.6.17.
Might as well stay as close to that as we can...
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
author ack@localhost.localdomain
date Thu Jun 29 14:39:07 2006 +0100 (2006-06-29)
parents a67c1bcb5522
children c157418212d8
files patches/linux-2.6.16.13/fix-hz-suspend.patch
line diff
     1.1 --- a/patches/linux-2.6.16.13/fix-hz-suspend.patch	Thu Jun 29 14:30:41 2006 +0100
     1.2 +++ b/patches/linux-2.6.16.13/fix-hz-suspend.patch	Thu Jun 29 14:39:07 2006 +0100
     1.3 @@ -1,22 +1,26 @@
     1.4  diff -pruN ../pristine-linux-2.6.16.13/kernel/timer.c ./kernel/timer.c
     1.5 ---- ../pristine-linux-2.6.16.13/kernel/timer.c	2006-05-02 14:38:44.000000000 -0700
     1.6 -+++ ./kernel/timer.c	2006-06-28 09:57:51.000000000 -0700
     1.7 -@@ -555,7 +555,17 @@ found:
     1.8 +--- ../pristine-linux-2.6.16.13/kernel/timer.c	2006-05-02 22:38:44.000000000 +0100
     1.9 ++++ ./kernel/timer.c	2006-06-29 14:34:12.788957720 +0100
    1.10 +@@ -555,6 +555,22 @@ found:
    1.11   	}
    1.12   	spin_unlock(&base->t_base.lock);
    1.13   
    1.14 --	if (time_before(hr_expires, expires))
    1.15  +	/*
    1.16 -+	 * If timers are pending, "expires" will be in the recent past
    1.17 -+	 * of "jiffies". If there are no hr_timers registered, "hr_expires"
    1.18 -+	 * will be "jiffies + MAX_JIFFY_OFFSET"; this is *just* short of being
    1.19 -+	 * considered to be before "jiffies". This makes it very likely that
    1.20 -+	 * "hr_expires" *will* be considered to be before "expires".
    1.21 -+	 * So we must check when there are pending timers (expires <= jiffies)
    1.22 -+	 * to ensure that we don't accidently tell the caller that there is
    1.23 -+	 * nothing scheduled until half an epoch (MAX_JIFFY_OFFSET)!
    1.24 ++	 * It can happen that other CPUs service timer IRQs and increment
    1.25 ++	 * jiffies, but we have not yet got a local timer tick to process
    1.26 ++	 * the timer wheels.  In that case, the expiry time can be before
    1.27 ++	 * jiffies, but since the high-resolution timer here is relative to
    1.28 ++	 * jiffies, the default expression when high-resolution timers are
    1.29 ++	 * not active,
    1.30 ++	 *
    1.31 ++	 *   time_before(MAX_JIFFY_OFFSET + jiffies, expires)
    1.32 ++	 *
    1.33 ++	 * would falsely evaluate to true.  If that is the case, just
    1.34 ++	 * return jiffies so that we can immediately fire the local timer
    1.35  +	 */
    1.36 -+	if (time_before(jiffies, expires) && time_before(hr_expires, expires))
    1.37 ++	if (time_before(expires, jiffies))
    1.38 ++		return jiffies;
    1.39 ++
    1.40 + 	if (time_before(hr_expires, expires))
    1.41   		return hr_expires;
    1.42   
    1.43 - 	return expires;