Skip to contentSkip to conversation

dynticks: Fix one off jiffy update

patch-mm Thomas Gleixner 2 participants 2 messages Jan 29, 2007 – Jan 31, 2007 Nohz, dynticks support

lore
Share & tools
lore
#0 lore raw

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).

kernel/time/tick-sched.c +3 -3
Index: 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);
 }
#1 lore raw
Quoted 8 lines · Thomas Gleixner

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).

Karsten - thanks for tracking this regression down to the jiffies update code! I'm wondering, do you still the suspend slowness problem with this fix applied as well?

Ingo