[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081126150645.GA28153@homer.shelbyville.oz>
Date: Thu, 27 Nov 2008 01:36:45 +1030
From: Ron <ron@...ian.org>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org
Subject: [patch] fix for sched_clock() when using jiffies
Hi,
I'm in the process of updating a port for an ARM based chip we've been
working on, from 2.6.22-rc4'ish to the current HEAD of Linus' tree, and
I started seeing the following:
[ 0.000000] PID hash table entries: 512 (order: 9, 2048 bytes)
[42949372.970000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
The reason appears to be that printk_clock() has been replaced with a
call to cpu_clock, which in our case currently falls back to the default
(weak) implementation of sched_clock() that uses jiffies -- but doesn't
account for the initial offset of the jiffy count. The following simple
patch fixes it for me, in line with what printk_clock used to do.
Cheers,
Ron
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index 8178724..d76814e 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -37,7 +37,7 @@
*/
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);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists