aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@openvz.org>2007-02-10 04:45:10 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:28 -0500
commitb035b6de24932ffd4a2b1c6619a2f5711da6920f (patch)
tree76f43316bf4788c510a1f271064b67ef8e584035
parent5e07e1ccb0c0f25dd748ebe2ef83008c2229bf1c (diff)
[PATCH] Consolidate default sched_clock()
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>
-rw-r--r--arch/alpha/kernel/time.c11
-rw-r--r--arch/arm/kernel/time.c10
-rw-r--r--arch/arm26/kernel/time.c8
-rw-r--r--arch/avr32/kernel/time.c9
-rw-r--r--arch/cris/kernel/time.c8
-rw-r--r--arch/h8300/kernel/time.c6
-rw-r--r--arch/m32r/kernel/time.c8
-rw-r--r--arch/m68k/kernel/time.c9
-rw-r--r--arch/m68knommu/kernel/time.c9
-rw-r--r--arch/mips/kernel/time.c5
-rw-r--r--arch/parisc/kernel/time.c11
-rw-r--r--arch/sh/kernel/time.c8
-rw-r--r--arch/sh64/kernel/time.c9
-rw-r--r--arch/sparc/kernel/time.c9
-rw-r--r--arch/v850/kernel/time.c8
-rw-r--r--arch/xtensa/kernel/time.c9
-rw-r--r--kernel/sched.c10
17 files changed, 10 insertions, 137 deletions
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index d7053eb4ffcf..4748e14a28bc 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -91,17 +91,6 @@ static inline __u32 rpcc(void)
91} 91}
92 92
93/* 93/*
94 * Scheduler clock - returns current time in nanosec units.
95 *
96 * Copied from ARM code for expediency... ;-}
97 */
98unsigned long long sched_clock(void)
99{
100 return (unsigned long long)jiffies * (1000000000 / HZ);
101}
102
103
104/*
105 * timer_interrupt() needs to keep up the real-time clock, 94 * timer_interrupt() needs to keep up the real-time clock,
106 * as well as call the "do_timer()" routine every clocktick 95 * as well as call the "do_timer()" routine every clocktick
107 */ 96 */
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 3c8cdcfe8d4a..ee47c532e210 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -78,16 +78,6 @@ static unsigned long dummy_gettimeoffset(void)
78#endif 78#endif
79 79
80/* 80/*
81 * Scheduler clock - returns current time in nanosec units.
82 * This is the default implementation. Sub-architecture
83 * implementations can override this.
84 */
85unsigned long long __attribute__((weak)) sched_clock(void)
86{
87 return (unsigned long long)jiffies * (1000000000 / HZ);
88}
89
90/*
91 * An implementation of printk_clock() independent from 81 * An implementation of printk_clock() independent from
92 * sched_clock(). This avoids non-bootable kernels when 82 * sched_clock(). This avoids non-bootable kernels when
93 * printk_clock is enabled. 83 * printk_clock is enabled.
diff --git a/arch/arm26/kernel/time.c b/arch/arm26/kernel/time.c
index 1206469b2b86..0f1d57fbd3d7 100644
--- a/arch/arm26/kernel/time.c
+++ b/arch/arm26/kernel/time.c
@@ -89,14 +89,6 @@ static unsigned long gettimeoffset(void)
89 return (offset + LATCH/2) / LATCH; 89 return (offset + LATCH/2) / LATCH;
90} 90}
91 91
92/*
93 * Scheduler clock - returns current time in nanosec units.
94 */
95unsigned long long sched_clock(void)
96{
97 return (unsigned long long)jiffies * (1000000000 / HZ);
98}
99
100static unsigned long next_rtc_update; 92static unsigned long next_rtc_update;
101 93
102/* 94/*
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 5a247ba71a72..a2f74affaa98 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -110,15 +110,6 @@ static void avr32_hpt_init(unsigned int count)
110} 110}
111 111
112/* 112/*
113 * Scheduler clock - returns current time in nanosec units.
114 */
115unsigned long long sched_clock(void)
116{
117 /* There must be better ways...? */
118 return (unsigned long long)jiffies * (1000000000 / HZ);
119}
120
121/*
122 * local_timer_interrupt() does profiling and process accounting on a 113 * local_timer_interrupt() does profiling and process accounting on a
123 * per-CPU basis. 114 * per-CPU basis.
124 * 115 *
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 22a1aa511aea..acfd04559405 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -216,14 +216,6 @@ cris_do_profile(struct pt_regs* regs)
216#endif 216#endif
217} 217}
218 218
219/*
220 * Scheduler clock - returns current time in nanosec units.
221 */
222unsigned long long sched_clock(void)
223{
224 return (unsigned long long)jiffies * (1000000000 / HZ);
225}
226
227static int 219static int
228__init init_udelay(void) 220__init init_udelay(void)
229{ 221{
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c
index 8abab3bc2b6f..d1ef615ba895 100644
--- a/arch/h8300/kernel/time.c
+++ b/arch/h8300/kernel/time.c
@@ -118,9 +118,3 @@ int do_settimeofday(struct timespec *tv)
118} 118}
119 119
120EXPORT_SYMBOL(do_settimeofday); 120EXPORT_SYMBOL(do_settimeofday);
121
122unsigned long long sched_clock(void)
123{
124 return (unsigned long long)jiffies * (1000000000 / HZ);
125
126}
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index a09038282c78..3858c9f39ba5 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -286,11 +286,3 @@ void __init time_init(void)
286#error no chip configuration 286#error no chip configuration
287#endif 287#endif
288} 288}
289
290/*
291 * Scheduler clock - returns current time in nanosec units.
292 */
293unsigned long long sched_clock(void)
294{
295 return (unsigned long long)jiffies * (1000000000 / HZ);
296}
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 2a599c3ed787..4c065f9ceffc 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -159,12 +159,3 @@ int do_settimeofday(struct timespec *tv)
159} 159}
160 160
161EXPORT_SYMBOL(do_settimeofday); 161EXPORT_SYMBOL(do_settimeofday);
162
163/*
164 * Scheduler clock - returns current time in ns units.
165 */
166unsigned long long sched_clock(void)
167{
168 return (unsigned long long)jiffies*(1000000000/HZ);
169}
170
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 11ea217ed5cf..467053da2d08 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -174,13 +174,4 @@ int do_settimeofday(struct timespec *tv)
174 clock_was_set(); 174 clock_was_set();
175 return 0; 175 return 0;
176} 176}
177
178/*
179 * Scheduler clock - returns current time in nanosec units.
180 */
181unsigned long long sched_clock(void)
182{
183 return (unsigned long long)jiffies * (1000000000 / HZ);
184}
185
186EXPORT_SYMBOL(do_settimeofday); 177EXPORT_SYMBOL(do_settimeofday);
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 8aa544f73a5e..545fcbc8cea2 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -455,8 +455,3 @@ EXPORT_SYMBOL(rtc_lock);
455EXPORT_SYMBOL(to_tm); 455EXPORT_SYMBOL(to_tm);
456EXPORT_SYMBOL(rtc_mips_set_time); 456EXPORT_SYMBOL(rtc_mips_set_time);
457EXPORT_SYMBOL(rtc_mips_get_time); 457EXPORT_SYMBOL(rtc_mips_get_time);
458
459unsigned long long sched_clock(void)
460{
461 return (unsigned long long)jiffies*(1000000000/HZ);
462}
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index bad7d1eb62b9..5f1b51af06a9 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -288,17 +288,6 @@ do_settimeofday (struct timespec *tv)
288} 288}
289EXPORT_SYMBOL(do_settimeofday); 289EXPORT_SYMBOL(do_settimeofday);
290 290
291/*
292 * XXX: We can do better than this.
293 * Returns nanoseconds
294 */
295
296unsigned long long sched_clock(void)
297{
298 return (unsigned long long)jiffies * (1000000000 / HZ);
299}
300
301
302void __init start_cpu_itimer(void) 291void __init start_cpu_itimer(void)
303{ 292{
304 unsigned int cpu = smp_processor_id(); 293 unsigned int cpu = smp_processor_id();
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index c206c9504c4b..d47e775962e9 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -41,14 +41,6 @@ static int null_rtc_set_time(const time_t secs)
41void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time; 41void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time;
42int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time; 42int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time;
43 43
44/*
45 * Scheduler clock - returns current time in nanosec units.
46 */
47unsigned long long __attribute__ ((weak)) sched_clock(void)
48{
49 return (unsigned long long)jiffies * (1000000000 / HZ);
50}
51
52#ifndef CONFIG_GENERIC_TIME 44#ifndef CONFIG_GENERIC_TIME
53void do_gettimeofday(struct timeval *tv) 45void do_gettimeofday(struct timeval *tv)
54{ 46{
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index 9c4a38a8698c..390b40de7cef 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -579,12 +579,3 @@ void enter_deep_standby(void)
579 asm __volatile__ ("nop"); 579 asm __volatile__ ("nop");
580 panic("Unexpected wakeup!\n"); 580 panic("Unexpected wakeup!\n");
581} 581}
582
583/*
584 * Scheduler clock - returns current time in nanosec units.
585 */
586unsigned long long sched_clock(void)
587{
588 return (unsigned long long)jiffies * (1000000000 / HZ);
589}
590
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 2fcce000d877..9bb1240aaf8a 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -436,15 +436,6 @@ static inline unsigned long do_gettimeoffset(void)
436 return (*master_l10_counter >> 10) & 0x1fffff; 436 return (*master_l10_counter >> 10) & 0x1fffff;
437} 437}
438 438
439/*
440 * Returns nanoseconds
441 * XXX This is a suboptimal implementation.
442 */
443unsigned long long sched_clock(void)
444{
445 return (unsigned long long)jiffies * (1000000000 / HZ);
446}
447
448/* Ok, my cute asm atomicity trick doesn't work anymore. 439/* Ok, my cute asm atomicity trick doesn't work anymore.
449 * There are just too many variables that need to be protected 440 * There are just too many variables that need to be protected
450 * now (both members of xtime, et al.) 441 * now (both members of xtime, et al.)
diff --git a/arch/v850/kernel/time.c b/arch/v850/kernel/time.c
index cd06f47c0ea7..486e3a441c86 100644
--- a/arch/v850/kernel/time.c
+++ b/arch/v850/kernel/time.c
@@ -28,14 +28,6 @@
28#define TICK_SIZE (tick_nsec / 1000) 28#define TICK_SIZE (tick_nsec / 1000)
29 29
30/* 30/*
31 * Scheduler clock - returns current time in nanosec units.
32 */
33unsigned long long sched_clock(void)
34{
35 return (unsigned long long)jiffies * (1000000000 / HZ);
36}
37
38/*
39 * timer_interrupt() needs to keep up the real-time clock, 31 * timer_interrupt() needs to keep up the real-time clock,
40 * as well as call the "do_timer()" routine every clocktick 32 * as well as call the "do_timer()" routine every clocktick
41 */ 33 */
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index a350431363a0..22949be4a5d8 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -38,15 +38,6 @@ unsigned long ccount_nsec; /* nsec per ccount increment */
38unsigned int last_ccount_stamp; 38unsigned int last_ccount_stamp;
39static long last_rtc_update = 0; 39static long last_rtc_update = 0;
40 40
41/*
42 * Scheduler clock - returns current tim in nanosec units.
43 */
44
45unsigned long long sched_clock(void)
46{
47 return (unsigned long long)jiffies * (1000000000 / HZ);
48}
49
50static irqreturn_t timer_interrupt(int irq, void *dev_id); 41static irqreturn_t timer_interrupt(int irq, void *dev_id);
51static struct irqaction timer_irqaction = { 42static struct irqaction timer_irqaction = {
52 .handler = timer_interrupt, 43 .handler = timer_interrupt,
diff --git a/kernel/sched.c b/kernel/sched.c
index cca93cc0dd7d..1cd4ee769e20 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -57,6 +57,16 @@
57#include <asm/unistd.h> 57#include <asm/unistd.h>
58 58
59/* 59/*
60 * Scheduler clock - returns current time in nanosec units.
61 * This is default implementation.
62 * Architectures and sub-architectures can override this.
63 */
64unsigned long long __attribute__((weak)) sched_clock(void)
65{
66 return (unsigned long long)jiffies * (1000000000 / HZ);
67}
68
69/*
60 * Convert user-nice values [ -20 ... 0 ... 19 ] 70 * Convert user-nice values [ -20 ... 0 ... 19 ]
61 * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ], 71 * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],
62 * and back. 72 * and back.