diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-09-29 05:00:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:15 -0400 |
commit | 3171a0305d62e6627a24bff35af4f997e4988a80 (patch) | |
tree | 5cf70462490528523172927c75f47970faa46ce9 /kernel/timer.c | |
parent | 27d91e07f9b863fa94491ffafe250580f0c2ce78 (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>
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 19 |
1 files changed, 6 insertions, 13 deletions
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 | */ |
1273 | static inline void update_times(void) | 1271 | static 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 | ||
1289 | void do_timer(struct pt_regs *regs) | 1284 | void 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 |