aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2006-09-29 05:00:32 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:15 -0400
commit3171a0305d62e6627a24bff35af4f997e4988a80 (patch)
tree5cf70462490528523172927c75f47970faa46ce9
parent27d91e07f9b863fa94491ffafe250580f0c2ce78 (diff)
[PATCH] simplify update_times (avoid jiffies/jiffies_64 aliasing problem)
Pass ticks to do_timer() and update_times(), and adjust x86_64 and s390 timer interrupt handler with this change. Currently update_times() calculates ticks by "jiffies - wall_jiffies", but callers of do_timer() should know how many ticks to update. Passing ticks get rid of this redundant calculation. Also there are another redundancy pointed out by Martin Schwidefsky. This cleanup make a barrier added by 5aee405c662ca644980c184774277fc6d0769a84 needless. So this patch removes it. As a bonus, this cleanup make wall_jiffies can be removed easily, since now wall_jiffies is always synced with jiffies. (This patch does not really remove wall_jiffies. It would be another cleanup patch) Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: john stultz <johnstul@us.ibm.com> Cc: Andi Kleen <ak@muc.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Acked-by: Russell King <rmk@arm.linux.org.uk> Cc: Ian Molton <spyro@f2s.com> Cc: Mikael Starvik <starvik@axis.com> Acked-by: David Howells <dhowells@redhat.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Hirokazu Takata <takata.hirokazu@renesas.com> Acked-by: Ralf Baechle <ralf@linux-mips.org> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp> Cc: Richard Curnow <rc@rc0.org.uk> Cc: William Lee Irwin III <wli@holomorphy.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp> Cc: Chris Zankel <chris@zankel.net> Acked-by: "Luck, Tony" <tony.luck@intel.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/alpha/kernel/time.c2
-rw-r--r--arch/arm/kernel/time.c2
-rw-r--r--arch/arm26/kernel/time.c2
-rw-r--r--arch/avr32/kernel/time.c2
-rw-r--r--arch/cris/arch-v10/kernel/time.c2
-rw-r--r--arch/cris/arch-v32/kernel/time.c2
-rw-r--r--arch/frv/kernel/time.c2
-rw-r--r--arch/h8300/kernel/time.c2
-rw-r--r--arch/ia64/kernel/time.c2
-rw-r--r--arch/m32r/kernel/time.c2
-rw-r--r--arch/m68k/kernel/time.c2
-rw-r--r--arch/m68k/sun3/sun3ints.c2
-rw-r--r--arch/m68knommu/kernel/time.c2
-rw-r--r--arch/mips/au1000/common/time.c6
-rw-r--r--arch/mips/gt64120/common/time.c2
-rw-r--r--arch/mips/kernel/time.c2
-rw-r--r--arch/mips/momentum/ocelot_g/gt-irq.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c2
-rw-r--r--arch/parisc/kernel/time.c2
-rw-r--r--arch/powerpc/kernel/time.c2
-rw-r--r--arch/ppc/kernel/time.c2
-rw-r--r--arch/s390/kernel/time.c9
-rw-r--r--arch/sh/kernel/time.c2
-rw-r--r--arch/sh64/kernel/time.c2
-rw-r--r--arch/sparc/kernel/pcic.c2
-rw-r--r--arch/sparc/kernel/time.c2
-rw-r--r--arch/sparc64/kernel/time.c4
-rw-r--r--arch/um/kernel/time.c2
-rw-r--r--arch/v850/kernel/time.c2
-rw-r--r--arch/x86_64/kernel/time.c8
-rw-r--r--arch/xtensa/kernel/time.c2
-rw-r--r--include/asm-arm/arch-clps711x/time.h2
-rw-r--r--include/asm-arm/arch-l7200/time.h2
-rw-r--r--include/asm-i386/mach-default/do_timer.h2
-rw-r--r--include/asm-i386/mach-visws/do_timer.h2
-rw-r--r--include/asm-i386/mach-voyager/do_timer.h2
-rw-r--r--include/linux/sched.h2
-rw-r--r--kernel/timer.c19
38 files changed, 52 insertions, 60 deletions
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index b191cc759737..7c1e44420a78 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -132,7 +132,7 @@ irqreturn_t timer_interrupt(int irq, void *dev, struct pt_regs * regs)
132 nticks = delta >> FIX_SHIFT; 132 nticks = delta >> FIX_SHIFT;
133 133
134 while (nticks > 0) { 134 while (nticks > 0) {
135 do_timer(regs); 135 do_timer(1);
136#ifndef CONFIG_SMP 136#ifndef CONFIG_SMP
137 update_process_times(user_mode(regs)); 137 update_process_times(user_mode(regs));
138#endif 138#endif
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index d4dceb5f06e9..f7d5165796ef 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -337,7 +337,7 @@ void timer_tick(struct pt_regs *regs)
337 profile_tick(CPU_PROFILING, regs); 337 profile_tick(CPU_PROFILING, regs);
338 do_leds(); 338 do_leds();
339 do_set_rtc(); 339 do_set_rtc();
340 do_timer(regs); 340 do_timer(1);
341#ifndef CONFIG_SMP 341#ifndef CONFIG_SMP
342 update_process_times(user_mode(regs)); 342 update_process_times(user_mode(regs));
343#endif 343#endif
diff --git a/arch/arm26/kernel/time.c b/arch/arm26/kernel/time.c
index db63d75d0715..80adbd005fc5 100644
--- a/arch/arm26/kernel/time.c
+++ b/arch/arm26/kernel/time.c
@@ -194,7 +194,7 @@ EXPORT_SYMBOL(do_settimeofday);
194 194
195static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 195static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
196{ 196{
197 do_timer(regs); 197 do_timer(1);
198#ifndef CONFIG_SMP 198#ifndef CONFIG_SMP
199 update_process_times(user_mode(regs)); 199 update_process_times(user_mode(regs));
200#endif 200#endif
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index b0e6b5855a38..3e56b9f4358a 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -148,7 +148,7 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
148 * Call the generic timer interrupt handler 148 * Call the generic timer interrupt handler
149 */ 149 */
150 write_seqlock(&xtime_lock); 150 write_seqlock(&xtime_lock);
151 do_timer(regs); 151 do_timer(1);
152 write_sequnlock(&xtime_lock); 152 write_sequnlock(&xtime_lock);
153 153
154 /* 154 /*
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 9c22b76e129a..ebacf1457d91 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -227,7 +227,7 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
227 227
228 /* call the real timer interrupt handler */ 228 /* call the real timer interrupt handler */
229 229
230 do_timer(regs); 230 do_timer(1);
231 231
232 cris_do_profile(regs); /* Save profiling information */ 232 cris_do_profile(regs); /* Save profiling information */
233 233
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
index 50f3f93293d6..be0a01657d4f 100644
--- a/arch/cris/arch-v32/kernel/time.c
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -219,7 +219,7 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
219 return IRQ_HANDLED; 219 return IRQ_HANDLED;
220 220
221 /* call the real timer interrupt handler */ 221 /* call the real timer interrupt handler */
222 do_timer(regs); 222 do_timer(1);
223 223
224 /* 224 /*
225 * If we have an externally synchronized Linux clock, then update 225 * If we have an externally synchronized Linux clock, then update
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index 3d0284bccb94..7e55884135ed 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -70,7 +70,7 @@ static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
70 */ 70 */
71 write_seqlock(&xtime_lock); 71 write_seqlock(&xtime_lock);
72 72
73 do_timer(regs); 73 do_timer(1);
74 update_process_times(user_mode(regs)); 74 update_process_times(user_mode(regs));
75 profile_tick(CPU_PROFILING, regs); 75 profile_tick(CPU_PROFILING, regs);
76 76
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c
index 688a5100604c..e569d17b4ae6 100644
--- a/arch/h8300/kernel/time.c
+++ b/arch/h8300/kernel/time.c
@@ -41,7 +41,7 @@ static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
41 /* may need to kick the hardware timer */ 41 /* may need to kick the hardware timer */
42 platform_timer_eoi(); 42 platform_timer_eoi();
43 43
44 do_timer(regs); 44 do_timer(1);
45#ifndef CONFIG_SMP 45#ifndef CONFIG_SMP
46 update_process_times(user_mode(regs)); 46 update_process_times(user_mode(regs));
47#endif 47#endif
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 6928ef0d64d8..16262687a103 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -78,7 +78,7 @@ timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
78 * xtime_lock. 78 * xtime_lock.
79 */ 79 */
80 write_seqlock(&xtime_lock); 80 write_seqlock(&xtime_lock);
81 do_timer(regs); 81 do_timer(1);
82 local_cpu_data->itm_next = new_itm; 82 local_cpu_data->itm_next = new_itm;
83 write_sequnlock(&xtime_lock); 83 write_sequnlock(&xtime_lock);
84 } else 84 } else
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index ded0be07a476..7a896893cd28 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -202,7 +202,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
202#ifndef CONFIG_SMP 202#ifndef CONFIG_SMP
203 profile_tick(CPU_PROFILING, regs); 203 profile_tick(CPU_PROFILING, regs);
204#endif 204#endif
205 do_timer(regs); 205 do_timer(1);
206 206
207#ifndef CONFIG_SMP 207#ifndef CONFIG_SMP
208 update_process_times(user_mode(regs)); 208 update_process_times(user_mode(regs));
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 98e4b1adfa29..1072e4946a4a 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -40,7 +40,7 @@ static inline int set_rtc_mmss(unsigned long nowtime)
40 */ 40 */
41static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs) 41static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
42{ 42{
43 do_timer(regs); 43 do_timer(1);
44#ifndef CONFIG_SMP 44#ifndef CONFIG_SMP
45 update_process_times(user_mode(regs)); 45 update_process_times(user_mode(regs));
46#endif 46#endif
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index f18b9d3ef16d..dc4ea7e074a6 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -65,7 +65,7 @@ static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp)
65#ifdef CONFIG_SUN3 65#ifdef CONFIG_SUN3
66 intersil_clear(); 66 intersil_clear();
67#endif 67#endif
68 do_timer(fp); 68 do_timer(1);
69#ifndef CONFIG_SMP 69#ifndef CONFIG_SMP
70 update_process_times(user_mode(fp)); 70 update_process_times(user_mode(fp));
71#endif 71#endif
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 1db987272220..db1e1ce0a349 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -51,7 +51,7 @@ static irqreturn_t timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
51 51
52 write_seqlock(&xtime_lock); 52 write_seqlock(&xtime_lock);
53 53
54 do_timer(regs); 54 do_timer(1);
55#ifndef CONFIG_SMP 55#ifndef CONFIG_SMP
56 update_process_times(user_mode(regs)); 56 update_process_times(user_mode(regs));
57#endif 57#endif
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c
index 7fbea1bf7b48..0a067f3113a5 100644
--- a/arch/mips/au1000/common/time.c
+++ b/arch/mips/au1000/common/time.c
@@ -96,7 +96,7 @@ void mips_timer_interrupt(struct pt_regs *regs)
96 timerlo = count; 96 timerlo = count;
97 97
98 kstat_this_cpu.irqs[irq]++; 98 kstat_this_cpu.irqs[irq]++;
99 do_timer(regs); 99 do_timer(1);
100#ifndef CONFIG_SMP 100#ifndef CONFIG_SMP
101 update_process_times(user_mode(regs)); 101 update_process_times(user_mode(regs));
102#endif 102#endif
@@ -137,7 +137,7 @@ irqreturn_t counter0_irq(int irq, void *dev_id, struct pt_regs *regs)
137 } 137 }
138 138
139 while (time_elapsed > 0) { 139 while (time_elapsed > 0) {
140 do_timer(regs); 140 do_timer(1);
141#ifndef CONFIG_SMP 141#ifndef CONFIG_SMP
142 update_process_times(user_mode(regs)); 142 update_process_times(user_mode(regs));
143#endif 143#endif
@@ -156,7 +156,7 @@ irqreturn_t counter0_irq(int irq, void *dev_id, struct pt_regs *regs)
156 156
157 if (jiffie_drift >= 999) { 157 if (jiffie_drift >= 999) {
158 jiffie_drift -= 999; 158 jiffie_drift -= 999;
159 do_timer(regs); /* increment jiffies by one */ 159 do_timer(1); /* increment jiffies by one */
160#ifndef CONFIG_SMP 160#ifndef CONFIG_SMP
161 update_process_times(user_mode(regs)); 161 update_process_times(user_mode(regs));
162#endif 162#endif
diff --git a/arch/mips/gt64120/common/time.c b/arch/mips/gt64120/common/time.c
index d837b26fbe51..7feca49350d1 100644
--- a/arch/mips/gt64120/common/time.c
+++ b/arch/mips/gt64120/common/time.c
@@ -34,7 +34,7 @@ static void gt64120_irq(int irq, void *dev_id, struct pt_regs *regs)
34 if (irq_src & 0x00000800) { /* Check for timer interrupt */ 34 if (irq_src & 0x00000800) { /* Check for timer interrupt */
35 handled = 1; 35 handled = 1;
36 irq_src &= ~0x00000800; 36 irq_src &= ~0x00000800;
37 do_timer(regs); 37 do_timer(1);
38#ifndef CONFIG_SMP 38#ifndef CONFIG_SMP
39 update_process_times(user_mode(regs)); 39 update_process_times(user_mode(regs));
40#endif 40#endif
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 170cb67f4ede..6ab8d975a974 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -434,7 +434,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
434 /* 434 /*
435 * call the generic timer interrupt handling 435 * call the generic timer interrupt handling
436 */ 436 */
437 do_timer(regs); 437 do_timer(1);
438 438
439 /* 439 /*
440 * If we have an externally synchronized Linux clock, then update 440 * If we have an externally synchronized Linux clock, then update
diff --git a/arch/mips/momentum/ocelot_g/gt-irq.c b/arch/mips/momentum/ocelot_g/gt-irq.c
index 9fb2493fff02..6cd87cf0195a 100644
--- a/arch/mips/momentum/ocelot_g/gt-irq.c
+++ b/arch/mips/momentum/ocelot_g/gt-irq.c
@@ -133,7 +133,7 @@ static irqreturn_t gt64240_p0int_irq(int irq, void *dev, struct pt_regs *regs)
133 MV_WRITE(TIMER_COUNTER_0_3_INTERRUPT_CAUSE, 0x0); 133 MV_WRITE(TIMER_COUNTER_0_3_INTERRUPT_CAUSE, 0x0);
134 134
135 /* handle the timer call */ 135 /* handle the timer call */
136 do_timer(regs); 136 do_timer(1);
137#ifndef CONFIG_SMP 137#ifndef CONFIG_SMP
138 update_process_times(user_mode(regs)); 138 update_process_times(user_mode(regs));
139#endif 139#endif
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index b029ba79c27a..c62a3a9ef867 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -111,7 +111,7 @@ again:
111 kstat_this_cpu.irqs[irq]++; /* kstat only for bootcpu? */ 111 kstat_this_cpu.irqs[irq]++; /* kstat only for bootcpu? */
112 112
113 if (cpu == 0) 113 if (cpu == 0)
114 do_timer(regs); 114 do_timer(1);
115 115
116 update_process_times(user_mode(regs)); 116 update_process_times(user_mode(regs));
117 117
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 5facc9bff4ef..700df10924dd 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -79,7 +79,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
79#endif 79#endif
80 if (cpu == 0) { 80 if (cpu == 0) {
81 write_seqlock(&xtime_lock); 81 write_seqlock(&xtime_lock);
82 do_timer(regs); 82 do_timer(1);
83 write_sequnlock(&xtime_lock); 83 write_sequnlock(&xtime_lock);
84 } 84 }
85 } 85 }
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 7a3c3f791ade..71f71da98e7d 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -693,7 +693,7 @@ void timer_interrupt(struct pt_regs * regs)
693 tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy; 693 tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy;
694 if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) { 694 if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) {
695 tb_last_jiffy = tb_next_jiffy; 695 tb_last_jiffy = tb_next_jiffy;
696 do_timer(regs); 696 do_timer(1);
697 timer_recalc_offset(tb_last_jiffy); 697 timer_recalc_offset(tb_last_jiffy);
698 timer_check_rtc(); 698 timer_check_rtc();
699 } 699 }
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
index 6ab8cc7226ab..1e1f31554767 100644
--- a/arch/ppc/kernel/time.c
+++ b/arch/ppc/kernel/time.c
@@ -153,7 +153,7 @@ void timer_interrupt(struct pt_regs * regs)
153 /* We are in an interrupt, no need to save/restore flags */ 153 /* We are in an interrupt, no need to save/restore flags */
154 write_seqlock(&xtime_lock); 154 write_seqlock(&xtime_lock);
155 tb_last_stamp = jiffy_stamp; 155 tb_last_stamp = jiffy_stamp;
156 do_timer(regs); 156 do_timer(1);
157 157
158 /* 158 /*
159 * update the rtc when needed, this should be performed on the 159 * update the rtc when needed, this should be performed on the
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 1981c6199fa2..abab42e9f5f8 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(do_settimeofday);
166void account_ticks(struct pt_regs *regs) 166void account_ticks(struct pt_regs *regs)
167{ 167{
168 __u64 tmp; 168 __u64 tmp;
169 __u32 ticks, xticks; 169 __u32 ticks;
170 170
171 /* Calculate how many ticks have passed. */ 171 /* Calculate how many ticks have passed. */
172 if (S390_lowcore.int_clock < S390_lowcore.jiffy_timer) { 172 if (S390_lowcore.int_clock < S390_lowcore.jiffy_timer) {
@@ -204,6 +204,7 @@ void account_ticks(struct pt_regs *regs)
204 */ 204 */
205 write_seqlock(&xtime_lock); 205 write_seqlock(&xtime_lock);
206 if (S390_lowcore.jiffy_timer > xtime_cc) { 206 if (S390_lowcore.jiffy_timer > xtime_cc) {
207 __u32 xticks;
207 tmp = S390_lowcore.jiffy_timer - xtime_cc; 208 tmp = S390_lowcore.jiffy_timer - xtime_cc;
208 if (tmp >= 2*CLK_TICKS_PER_JIFFY) { 209 if (tmp >= 2*CLK_TICKS_PER_JIFFY) {
209 xticks = __div(tmp, CLK_TICKS_PER_JIFFY); 210 xticks = __div(tmp, CLK_TICKS_PER_JIFFY);
@@ -212,13 +213,11 @@ void account_ticks(struct pt_regs *regs)
212 xticks = 1; 213 xticks = 1;
213 xtime_cc += CLK_TICKS_PER_JIFFY; 214 xtime_cc += CLK_TICKS_PER_JIFFY;
214 } 215 }
215 while (xticks--) 216 do_timer(xticks);
216 do_timer(regs);
217 } 217 }
218 write_sequnlock(&xtime_lock); 218 write_sequnlock(&xtime_lock);
219#else 219#else
220 for (xticks = ticks; xticks > 0; xticks--) 220 do_timer(ticks);
221 do_timer(regs);
222#endif 221#endif
223 222
224#ifdef CONFIG_VIRT_CPU_ACCOUNTING 223#ifdef CONFIG_VIRT_CPU_ACCOUNTING
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index 149d9713eddf..f664a196c4f5 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -117,7 +117,7 @@ static long last_rtc_update;
117 */ 117 */
118void handle_timer_tick(struct pt_regs *regs) 118void handle_timer_tick(struct pt_regs *regs)
119{ 119{
120 do_timer(regs); 120 do_timer(1);
121#ifndef CONFIG_SMP 121#ifndef CONFIG_SMP
122 update_process_times(user_mode(regs)); 122 update_process_times(user_mode(regs));
123#endif 123#endif
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index b8162e59030e..3b61e06f9d72 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -298,7 +298,7 @@ static inline void do_timer_interrupt(int irq, struct pt_regs *regs)
298 asm ("getcon cr62, %0" : "=r" (current_ctc)); 298 asm ("getcon cr62, %0" : "=r" (current_ctc));
299 ctc_last_interrupt = (unsigned long) current_ctc; 299 ctc_last_interrupt = (unsigned long) current_ctc;
300 300
301 do_timer(regs); 301 do_timer(1);
302#ifndef CONFIG_SMP 302#ifndef CONFIG_SMP
303 update_process_times(user_mode(regs)); 303 update_process_times(user_mode(regs));
304#endif 304#endif
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index bfd31aac2df3..e19b1bad9bc5 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -712,7 +712,7 @@ static irqreturn_t pcic_timer_handler (int irq, void *h, struct pt_regs *regs)
712{ 712{
713 write_seqlock(&xtime_lock); /* Dummy, to show that we remember */ 713 write_seqlock(&xtime_lock); /* Dummy, to show that we remember */
714 pcic_clear_clock_irq(); 714 pcic_clear_clock_irq();
715 do_timer(regs); 715 do_timer(1);
716#ifndef CONFIG_SMP 716#ifndef CONFIG_SMP
717 update_process_times(user_mode(regs)); 717 update_process_times(user_mode(regs));
718#endif 718#endif
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 845081b01267..6f84fa1b58e5 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -128,7 +128,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
128#endif 128#endif
129 clear_clock_irq(); 129 clear_clock_irq();
130 130
131 do_timer(regs); 131 do_timer(1);
132#ifndef CONFIG_SMP 132#ifndef CONFIG_SMP
133 update_process_times(user_mode(regs)); 133 update_process_times(user_mode(regs));
134#endif 134#endif
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index b0b4feeec098..ca1193482f07 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -465,7 +465,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
465 profile_tick(CPU_PROFILING, regs); 465 profile_tick(CPU_PROFILING, regs);
466 update_process_times(user_mode(regs)); 466 update_process_times(user_mode(regs));
467#endif 467#endif
468 do_timer(regs); 468 do_timer(1);
469 469
470 /* Guarantee that the following sequences execute 470 /* Guarantee that the following sequences execute
471 * uninterrupted. 471 * uninterrupted.
@@ -496,7 +496,7 @@ void timer_tick_interrupt(struct pt_regs *regs)
496{ 496{
497 write_seqlock(&xtime_lock); 497 write_seqlock(&xtime_lock);
498 498
499 do_timer(regs); 499 do_timer(1);
500 500
501 timer_check_rtc(); 501 timer_check_rtc();
502 502
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 820affbf3e16..a92965f8f9cd 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -93,7 +93,7 @@ irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs)
93 93
94 write_seqlock_irqsave(&xtime_lock, flags); 94 write_seqlock_irqsave(&xtime_lock, flags);
95 95
96 do_timer(regs); 96 do_timer(1);
97 97
98 nsecs = get_time(); 98 nsecs = get_time();
99 xtime.tv_sec = nsecs / NSEC_PER_SEC; 99 xtime.tv_sec = nsecs / NSEC_PER_SEC;
diff --git a/arch/v850/kernel/time.c b/arch/v850/kernel/time.c
index a0b46695f186..f4d1a4d3cdc2 100644
--- a/arch/v850/kernel/time.c
+++ b/arch/v850/kernel/time.c
@@ -51,7 +51,7 @@ static irqreturn_t timer_interrupt (int irq, void *dummy, struct pt_regs *regs)
51 if (mach_tick) 51 if (mach_tick)
52 mach_tick (); 52 mach_tick ();
53 53
54 do_timer (regs); 54 do_timer (1);
55#ifndef CONFIG_SMP 55#ifndef CONFIG_SMP
56 update_process_times(user_mode(regs)); 56 update_process_times(user_mode(regs));
57#endif 57#endif
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 1c255ee76e7c..7ea3bf2a858c 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -415,16 +415,16 @@ void main_timer_handler(struct pt_regs *regs)
415 (((long) offset << US_SCALE) / vxtime.tsc_quot) - 1; 415 (((long) offset << US_SCALE) / vxtime.tsc_quot) - 1;
416 } 416 }
417 417
418 if (lost > 0) { 418 if (lost > 0)
419 handle_lost_ticks(lost, regs); 419 handle_lost_ticks(lost, regs);
420 jiffies += lost; 420 else
421 } 421 lost = 0;
422 422
423/* 423/*
424 * Do the timer stuff. 424 * Do the timer stuff.
425 */ 425 */
426 426
427 do_timer(regs); 427 do_timer(lost + 1);
428#ifndef CONFIG_SMP 428#ifndef CONFIG_SMP
429 update_process_times(user_mode(regs)); 429 update_process_times(user_mode(regs));
430#endif 430#endif
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 412ab32de391..241db201f40e 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -175,7 +175,7 @@ again:
175 175
176 last_ccount_stamp = next; 176 last_ccount_stamp = next;
177 next += CCOUNT_PER_JIFFY; 177 next += CCOUNT_PER_JIFFY;
178 do_timer (regs); /* Linux handler in kernel/timer.c */ 178 do_timer (1); /* Linux handler in kernel/timer.c */
179 179
180 if (ntp_synced() && 180 if (ntp_synced() &&
181 xtime.tv_sec - last_rtc_update >= 659 && 181 xtime.tv_sec - last_rtc_update >= 659 &&
diff --git a/include/asm-arm/arch-clps711x/time.h b/include/asm-arm/arch-clps711x/time.h
index 9cb27cd4e6ae..0e4a3901d3b3 100644
--- a/include/asm-arm/arch-clps711x/time.h
+++ b/include/asm-arm/arch-clps711x/time.h
@@ -29,7 +29,7 @@ static irqreturn_t
29p720t_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 29p720t_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
30{ 30{
31 do_leds(); 31 do_leds();
32 do_timer(regs); 32 do_timer(1);
33#ifndef CONFIG_SMP 33#ifndef CONFIG_SMP
34 update_process_times(user_mode(regs)); 34 update_process_times(user_mode(regs));
35#endif 35#endif
diff --git a/include/asm-arm/arch-l7200/time.h b/include/asm-arm/arch-l7200/time.h
index 7b98b533e63a..c69cb508735f 100644
--- a/include/asm-arm/arch-l7200/time.h
+++ b/include/asm-arm/arch-l7200/time.h
@@ -45,7 +45,7 @@
45static irqreturn_t 45static irqreturn_t
46timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 46timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
47{ 47{
48 do_timer(regs); 48 do_timer(1);
49#ifndef CONFIG_SMP 49#ifndef CONFIG_SMP
50 update_process_times(user_mode(regs)); 50 update_process_times(user_mode(regs));
51#endif 51#endif
diff --git a/include/asm-i386/mach-default/do_timer.h b/include/asm-i386/mach-default/do_timer.h
index 6312c3e79814..4182c347ef85 100644
--- a/include/asm-i386/mach-default/do_timer.h
+++ b/include/asm-i386/mach-default/do_timer.h
@@ -16,7 +16,7 @@
16 16
17static inline void do_timer_interrupt_hook(struct pt_regs *regs) 17static inline void do_timer_interrupt_hook(struct pt_regs *regs)
18{ 18{
19 do_timer(regs); 19 do_timer(1);
20#ifndef CONFIG_SMP 20#ifndef CONFIG_SMP
21 update_process_times(user_mode_vm(regs)); 21 update_process_times(user_mode_vm(regs));
22#endif 22#endif
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
index 95568e6ca91c..8db618c5a72b 100644
--- a/include/asm-i386/mach-visws/do_timer.h
+++ b/include/asm-i386/mach-visws/do_timer.h
@@ -9,7 +9,7 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
9 /* Clear the interrupt */ 9 /* Clear the interrupt */
10 co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR); 10 co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);
11 11
12 do_timer(regs); 12 do_timer(1);
13#ifndef CONFIG_SMP 13#ifndef CONFIG_SMP
14 update_process_times(user_mode_vm(regs)); 14 update_process_times(user_mode_vm(regs));
15#endif 15#endif
diff --git a/include/asm-i386/mach-voyager/do_timer.h b/include/asm-i386/mach-voyager/do_timer.h
index eaf518098981..099fe9f5c1b2 100644
--- a/include/asm-i386/mach-voyager/do_timer.h
+++ b/include/asm-i386/mach-voyager/do_timer.h
@@ -3,7 +3,7 @@
3 3
4static inline void do_timer_interrupt_hook(struct pt_regs *regs) 4static inline void do_timer_interrupt_hook(struct pt_regs *regs)
5{ 5{
6 do_timer(regs); 6 do_timer(1);
7#ifndef CONFIG_SMP 7#ifndef CONFIG_SMP
8 update_process_times(user_mode_vm(regs)); 8 update_process_times(user_mode_vm(regs));
9#endif 9#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ed2af8671589..503dea61ff99 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1206,7 +1206,7 @@ extern void switch_uid(struct user_struct *);
1206 1206
1207#include <asm/current.h> 1207#include <asm/current.h>
1208 1208
1209extern void do_timer(struct pt_regs *); 1209extern void do_timer(unsigned long ticks);
1210 1210
1211extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state)); 1211extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state));
1212extern int FASTCALL(wake_up_process(struct task_struct * tsk)); 1212extern int FASTCALL(wake_up_process(struct task_struct * tsk));
diff --git a/kernel/timer.c b/kernel/timer.c
index a2cb1ecb1b28..4f55622b0d38 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1222,10 +1222,8 @@ static inline void calc_load(unsigned long ticks)
1222 unsigned long active_tasks; /* fixed-point */ 1222 unsigned long active_tasks; /* fixed-point */
1223 static int count = LOAD_FREQ; 1223 static int count = LOAD_FREQ;
1224 1224
1225 count -= ticks; 1225 active_tasks = count_active_tasks();
1226 if (count < 0) { 1226 for (count -= ticks; count < 0; count += LOAD_FREQ) {
1227 count += LOAD_FREQ;
1228 active_tasks = count_active_tasks();
1229 CALC_LOAD(avenrun[0], EXP_1, active_tasks); 1227 CALC_LOAD(avenrun[0], EXP_1, active_tasks);
1230 CALC_LOAD(avenrun[1], EXP_5, active_tasks); 1228 CALC_LOAD(avenrun[1], EXP_5, active_tasks);
1231 CALC_LOAD(avenrun[2], EXP_15, active_tasks); 1229 CALC_LOAD(avenrun[2], EXP_15, active_tasks);
@@ -1270,11 +1268,8 @@ void run_local_timers(void)
1270 * Called by the timer interrupt. xtime_lock must already be taken 1268 * Called by the timer interrupt. xtime_lock must already be taken
1271 * by the timer IRQ! 1269 * by the timer IRQ!
1272 */ 1270 */
1273static inline void update_times(void) 1271static inline void update_times(unsigned long ticks)
1274{ 1272{
1275 unsigned long ticks;
1276
1277 ticks = jiffies - wall_jiffies;
1278 wall_jiffies += ticks; 1273 wall_jiffies += ticks;
1279 update_wall_time(); 1274 update_wall_time();
1280 calc_load(ticks); 1275 calc_load(ticks);
@@ -1286,12 +1281,10 @@ static inline void update_times(void)
1286 * jiffies is defined in the linker script... 1281 * jiffies is defined in the linker script...
1287 */ 1282 */
1288 1283
1289void do_timer(struct pt_regs *regs) 1284void do_timer(unsigned long ticks)
1290{ 1285{
1291 jiffies_64++; 1286 jiffies_64 += ticks;
1292 /* prevent loading jiffies before storing new jiffies_64 value. */ 1287 update_times(ticks);
1293 barrier();
1294 update_times();
1295} 1288}
1296 1289
1297#ifdef __ARCH_WANT_SYS_ALARM 1290#ifdef __ARCH_WANT_SYS_ALARM