sched: Fix fallback sched_clock()'s offset when using jiffies
authorRon <[email protected]>
Fri, 8 May 2009 13:24:49 +0000 (22:54 +0930)
committerIngo Molnar <[email protected]>
Sat, 9 May 2009 08:08:19 +0000 (10:08 +0200)
Account for the initial offset to the jiffy count.

[ Impact: fix printk timestamps on architectures using fallback sched_clock() ]

Signed-off-by: Ron Lee <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
kernel/sched_clock.c

index 819f17ac796efeeee1068efe3e6a27ac952d3a16..e1d16c9a76806ef945e4271a9cfcef9ac1a0a0d9 100644 (file)
@@ -38,7 +38,8 @@
  */
 unsigned long long __attribute__((weak)) sched_clock(void)
 {
-       return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ);
+       return (unsigned long long)(jiffies - INITIAL_JIFFIES)
+                                       * (NSEC_PER_SEC / HZ);
 }
 
 static __read_mostly int sched_clock_running;