[PATCH] Consolidate default sched_clock()
authorAlexey Dobriyan <adobriyan@openvz.org>
Sat, 10 Feb 2007 09:45:10 +0000 (01:45 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 11 Feb 2007 18:51:28 +0000 (10:51 -0800)
Use attribute(weak).

Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 files changed:
arch/alpha/kernel/time.c
arch/arm/kernel/time.c
arch/arm26/kernel/time.c
arch/avr32/kernel/time.c
arch/cris/kernel/time.c
arch/h8300/kernel/time.c
arch/m32r/kernel/time.c
arch/m68k/kernel/time.c
arch/m68knommu/kernel/time.c
arch/mips/kernel/time.c
arch/parisc/kernel/time.c
arch/sh/kernel/time.c
arch/sh64/kernel/time.c
arch/sparc/kernel/time.c
arch/v850/kernel/time.c
arch/xtensa/kernel/time.c
kernel/sched.c

index d7053eb4ffcfd93623d58aabda82d30cf9118dee..4748e14a28bca3b9edd05b73d0787b60367cee7d 100644 (file)
@@ -90,17 +90,6 @@ static inline __u32 rpcc(void)
     return result;
 }
 
-/*
- * Scheduler clock - returns current time in nanosec units.
- *
- * Copied from ARM code for expediency... ;-}
- */
-unsigned long long sched_clock(void)
-{
-        return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
-
 /*
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "do_timer()" routine every clocktick
index 3c8cdcfe8d4a9f72c9ffb3762a72b260be85d73c..ee47c532e2108b0879bef642c3a5ee174891b581 100644 (file)
@@ -77,16 +77,6 @@ static unsigned long dummy_gettimeoffset(void)
 }
 #endif
 
-/*
- * Scheduler clock - returns current time in nanosec units.
- * This is the default implementation.  Sub-architecture
- * implementations can override this.
- */
-unsigned long long __attribute__((weak)) sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
 /*
  * An implementation of printk_clock() independent from
  * sched_clock().  This avoids non-bootable kernels when
index 1206469b2b86249574f0dd111a83d457b960c7a8..0f1d57fbd3d7bea278fed6bf0ed3a20b0e7ce8d6 100644 (file)
@@ -89,14 +89,6 @@ static unsigned long gettimeoffset(void)
         return (offset + LATCH/2) / LATCH;
 }
 
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
 static unsigned long next_rtc_update;
 
 /*
index 5a247ba71a72e1bdfcd036e3ca8840eb35fbfe08..a2f74affaa98b920729d629a71d55c796475e0e3 100644 (file)
@@ -109,15 +109,6 @@ static void avr32_hpt_init(unsigned int count)
        sysreg_write(COUNT, count);
 }
 
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
-       /* There must be better ways...? */
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
 /*
  * local_timer_interrupt() does profiling and process accounting on a
  * per-CPU basis.
index 22a1aa511aea1d690d85b6f4855c0d5043e5884c..acfd0455940590c5e5292ce86b89dde0e1b0200e 100644 (file)
@@ -216,14 +216,6 @@ cris_do_profile(struct pt_regs* regs)
 #endif
 }
 
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
 static int
 __init init_udelay(void)
 {
index 8abab3bc2b6fe1615cf80c71e3ca6450e8ee91f2..d1ef615ba895369ffb4883b082600e1e66e9651f 100644 (file)
@@ -118,9 +118,3 @@ int do_settimeofday(struct timespec *tv)
 }
 
 EXPORT_SYMBOL(do_settimeofday);
-
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-
-}
index a09038282c78a3f5b452f4c4cbbf06120283d15f..3858c9f39ba5fb2362ad60e5ce381514e5c7c933 100644 (file)
@@ -286,11 +286,3 @@ void __init time_init(void)
 #error no chip configuration
 #endif
 }
-
-/*
- *  Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
index 2a599c3ed7878322239737583dd0137399e19077..4c065f9ceffcd5ab7fcfe6e8de09b3e6d2adacc9 100644 (file)
@@ -159,12 +159,3 @@ int do_settimeofday(struct timespec *tv)
 }
 
 EXPORT_SYMBOL(do_settimeofday);
-
-/*
- * Scheduler clock - returns current time in ns units.
- */
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies*(1000000000/HZ);
-}
-
index 11ea217ed5cfa153f6d2b8e550ea1a23eee5fea2..467053da2d08343d29f77c7cc31529c7caef8e54 100644 (file)
@@ -174,13 +174,4 @@ int do_settimeofday(struct timespec *tv)
        clock_was_set();
        return 0;
 }
-
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
 EXPORT_SYMBOL(do_settimeofday);
index 8aa544f73a5ea27fd85eb007ac9ec59938e0ff35..545fcbc8cea2283525f3b7fd6b214c9646c9545e 100644 (file)
@@ -455,8 +455,3 @@ EXPORT_SYMBOL(rtc_lock);
 EXPORT_SYMBOL(to_tm);
 EXPORT_SYMBOL(rtc_mips_set_time);
 EXPORT_SYMBOL(rtc_mips_get_time);
-
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies*(1000000000/HZ);
-}
index bad7d1eb62b975dff89921860ca30e816e948de3..5f1b51af06a9820ff54e57479c50543eacb0799f 100644 (file)
@@ -288,17 +288,6 @@ do_settimeofday (struct timespec *tv)
 }
 EXPORT_SYMBOL(do_settimeofday);
 
-/*
- * XXX: We can do better than this.
- * Returns nanoseconds
- */
-
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
-
 void __init start_cpu_itimer(void)
 {
        unsigned int cpu = smp_processor_id();
index c206c9504c4bb40da950a374ead73943f9ab36a4..d47e775962e955054f8e0296f4f3a5fdd65377e5 100644 (file)
@@ -41,14 +41,6 @@ static int null_rtc_set_time(const time_t secs)
 void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time;
 int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time;
 
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long __attribute__ ((weak)) sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
 #ifndef CONFIG_GENERIC_TIME
 void do_gettimeofday(struct timeval *tv)
 {
index 9c4a38a8698c608e353a04831fc1761fcd99e526..390b40de7cefcb6886b81bc50ad6513cfbf3b43f 100644 (file)
@@ -579,12 +579,3 @@ void enter_deep_standby(void)
        asm __volatile__ ("nop");
        panic("Unexpected wakeup!\n");
 }
-
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
index 2fcce000d87731c8c13a5965842f13b71bb6f251..9bb1240aaf8afee365a25a14b566de19f02ce601 100644 (file)
@@ -436,15 +436,6 @@ static inline unsigned long do_gettimeoffset(void)
        return (*master_l10_counter >> 10) & 0x1fffff;
 }
 
-/*
- * Returns nanoseconds
- * XXX This is a suboptimal implementation.
- */
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
 /* Ok, my cute asm atomicity trick doesn't work anymore.
  * There are just too many variables that need to be protected
  * now (both members of xtime, et al.)
index cd06f47c0ea7404bfd29f15f31e222ca9c2f5260..486e3a441c868d2ae97efd01fdab9d0e74de0b2e 100644 (file)
 
 #define TICK_SIZE      (tick_nsec / 1000)
 
-/*
- * Scheduler clock - returns current time in nanosec units.
- */
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
 /*
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "do_timer()" routine every clocktick
index a350431363a0a8c56080c170ab5a7ff88db2c50d..22949be4a5d8cc3c5d62f93b8779a67c3ecd451f 100644 (file)
@@ -38,15 +38,6 @@ unsigned long ccount_nsec;           /* nsec per ccount increment */
 unsigned int last_ccount_stamp;
 static long last_rtc_update = 0;
 
-/*
- * Scheduler clock - returns current tim in nanosec units.
- */
-
-unsigned long long sched_clock(void)
-{
-       return (unsigned long long)jiffies * (1000000000 / HZ);
-}
-
 static irqreturn_t timer_interrupt(int irq, void *dev_id);
 static struct irqaction timer_irqaction = {
        .handler =      timer_interrupt,
index cca93cc0dd7d8ba7272b1ea4782e87c97bfe1a09..1cd4ee769e200afc682af2353a4fa7604d41224c 100644 (file)
 
 #include <asm/unistd.h>
 
+/*
+ * Scheduler clock - returns current time in nanosec units.
+ * This is default implementation.
+ * Architectures and sub-architectures can override this.
+ */
+unsigned long long __attribute__((weak)) sched_clock(void)
+{
+       return (unsigned long long)jiffies * (1000000000 / HZ);
+}
+
 /*
  * Convert user-nice values [ -20 ... 0 ... 19 ]
  * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],