projects/linux·commit 92d23f70

sched: Fix fallback sched_clock()'s offset when using jiffies

92d23f70 · Ron <[email protected]> · 2009-05-08 22:54:49 +09:30

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]>
Commit
92d23f703c608fcb2c8edd74a3fd0f4031e18606
Parents
091bf762

Changes

1 files changed · +2 −1

FileStatusAddDelContent
kernel/sched_clock.cmodified+2−1View file

kernel/sched_clock.c

View file
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index 819f17a..e1d16c9 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -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;