[patch-mm] dynticks: Fix one off jiffy update

From: Thomas Gleixner
Date: Mon Jan 29 2007 - 18:24:25 EST


Sigh. /me wanted to be too clever and needs to order more brown
paperbags now.

The rework of the jiffy update code introduced a one off error, which
led to a one off accounting error for last_jiffy_update. This made
jiffies lag behind.

Noticed by Karsten Wiese (cpufreq_ondemand weirdness).

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

Index: linux-2.6.20-rc6-mm/kernel/time/tick-sched.c
===================================================================
--- linux-2.6.20-rc6-mm.orig/kernel/time/tick-sched.c
+++ linux-2.6.20-rc6-mm/kernel/time/tick-sched.c
@@ -43,7 +43,7 @@ struct tick_sched *tick_get_tick_sched(i
*/
static void tick_do_update_jiffies64(ktime_t now)
{
- unsigned long ticks = 1;
+ unsigned long ticks = 0;
ktime_t delta;

/* Reevalute with xtime_lock held */
@@ -60,12 +60,12 @@ static void tick_do_update_jiffies64(kti
if (unlikely(delta.tv64 >= tick_period.tv64)) {
s64 incr = ktime_to_ns(tick_period);

- ticks += ktime_divns(delta, incr);
+ ticks = ktime_divns(delta, incr);

last_jiffies_update = ktime_add_ns(last_jiffies_update,
incr * ticks);
}
- do_timer(ticks);
+ do_timer(++ticks);
}
write_sequnlock(&xtime_lock);
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/