sched: Fix fallback sched_clock()'s offset when using jiffies
authorRon <ron@voicetronix.com>
Fri, 8 May 2009 13:24:49 +0000 (22:54 +0930)
committerIngo Molnar <mingo@elte.hu>
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 <ron@debian.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched_clock.c

index 819f17ac796efeeee1068efe3e6a27ac952d3a16..e1d16c9a76806ef945e4271a9cfcef9ac1a0a0d9 100644 (file)
@@ -38,7 +38,8 @@
  */
 unsigned long long __attribute__((weak)) sched_clock(void)
 {
  */
 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;
 }
 
 static __read_mostly int sched_clock_running;