public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] Use jiffies_64 in sched_clock()
@ 2006-12-29 15:52 Alexey Dobriyan
  0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2006-12-29 15:52 UTC (permalink / raw)
  To: linux-kernel, linux-arch; +Cc: devel

Would it make sense to always use jiffies_64 instead of jiffies?
(module hardware specific version)

This is what FRV, UML, one ia64 version, one i386 version do.

Also substract initial jiffies.

Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
---

 arch/frv/kernel/time.c |    8 --------
 arch/um/kernel/time.c  |    8 --------
 kernel/sched.c         |    3 ++-
 3 files changed, 2 insertions(+), 17 deletions(-)

--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -139,11 +139,3 @@ void time_init(void)
 
 	time_divisor_init();
 }
-
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
-	return jiffies_64 * (1000000000 / HZ);
-}
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -27,14 +27,6 @@ int hz(void)
 	return(HZ);
 }
 
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
-	return (unsigned long long)jiffies_64 * (1000000000 / HZ);
-}
-
 static unsigned long long prev_nsecs;
 #ifdef CONFIG_UML_REAL_TIME_CLOCK
 static long long delta;   		/* Deviation per interval */
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -64,7 +64,8 @@ #include <asm/unistd.h>
  */
 unsigned long long __attribute__((weak)) sched_clock(void)
 {
-	return (unsigned long long)jiffies * (1000000000 / HZ);
+	/* No locking but a rare wrong value is not a big deal. */
+	return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
 }
 
 /*


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-12-29 15:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-29 15:52 [RFC] Use jiffies_64 in sched_clock() Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox