Skip to content

Commit 8ef3860

Browse files
atsushi-nemotoLinus Torvalds
authored andcommitted
[PATCH] kill wall_jiffies
With 2.6.18-rc4-mm2, now wall_jiffies will always be the same as jiffies. So we can kill wall_jiffies completely. This is just a cleanup and logically should not change any real behavior except for one thing: RTC updating code in (old) ppc and xtensa use a condition "jiffies - wall_jiffies == 1". This condition is never met so I suppose it is just a bug. I just remove that condition only instead of kill the whole "if" block. [heiko.carstens@de.ibm.com: s390 build fix and cleanup] Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> 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> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Ian Molton <spyro@f2s.com> Cc: Mikael Starvik <starvik@axis.com> Cc: David Howells <dhowells@redhat.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Hirokazu Takata <takata.hirokazu@renesas.com> Cc: 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> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 70bc42f commit 8ef3860

26 files changed

Lines changed: 35 additions & 190 deletions

File tree

‎arch/alpha/kernel/time.c‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
#include "proto.h"
5555
#include "irq_impl.h"
5656

57-
extern unsigned long wall_jiffies; /* kernel/timer.c */
58-
5957
static int set_rtc_mmss(unsigned long);
6058

6159
DEFINE_SPINLOCK(rtc_lock);
@@ -413,7 +411,7 @@ void
413411
do_gettimeofday(struct timeval *tv)
414412
{
415413
unsigned long flags;
416-
unsigned long sec, usec, lost, seq;
414+
unsigned long sec, usec, seq;
417415
unsigned long delta_cycles, delta_usec, partial_tick;
418416

419417
do {
@@ -423,14 +421,13 @@ do_gettimeofday(struct timeval *tv)
423421
sec = xtime.tv_sec;
424422
usec = (xtime.tv_nsec / 1000);
425423
partial_tick = state.partial_tick;
426-
lost = jiffies - wall_jiffies;
427424

428425
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
429426

430427
#ifdef CONFIG_SMP
431428
/* Until and unless we figure out how to get cpu cycle counters
432429
in sync and keep them there, we can't use the rpcc tricks. */
433-
delta_usec = lost * (1000000 / HZ);
430+
delta_usec = 0;
434431
#else
435432
/*
436433
* usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks)
@@ -446,8 +443,7 @@ do_gettimeofday(struct timeval *tv)
446443
*/
447444

448445
delta_usec = (delta_cycles * state.scaled_ticks_per_cycle
449-
+ partial_tick
450-
+ (lost << FIX_SHIFT)) * 15625;
446+
+ partial_tick) * 15625;
451447
delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
452448
#endif
453449

@@ -480,12 +476,11 @@ do_settimeofday(struct timespec *tv)
480476
time. Without this, a full-tick error is possible. */
481477

482478
#ifdef CONFIG_SMP
483-
delta_nsec = (jiffies - wall_jiffies) * (NSEC_PER_SEC / HZ);
479+
delta_nsec = 0;
484480
#else
485481
delta_nsec = rpcc() - state.last_time;
486482
delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle
487-
+ state.partial_tick
488-
+ ((jiffies - wall_jiffies) << FIX_SHIFT)) * 15625;
483+
+ state.partial_tick) * 15625;
489484
delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
490485
delta_nsec *= 1000;
491486
#endif

‎arch/arm/kernel/time.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
*/
3838
struct sys_timer *system_timer;
3939

40-
extern unsigned long wall_jiffies;
41-
4240
/* this needs a better home */
4341
DEFINE_SPINLOCK(rtc_lock);
4442

@@ -237,16 +235,11 @@ void do_gettimeofday(struct timeval *tv)
237235
{
238236
unsigned long flags;
239237
unsigned long seq;
240-
unsigned long usec, sec, lost;
238+
unsigned long usec, sec;
241239

242240
do {
243241
seq = read_seqbegin_irqsave(&xtime_lock, flags);
244242
usec = system_timer->offset();
245-
246-
lost = jiffies - wall_jiffies;
247-
if (lost)
248-
usec += lost * USECS_PER_JIFFY;
249-
250243
sec = xtime.tv_sec;
251244
usec += xtime.tv_nsec / 1000;
252245
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -279,7 +272,6 @@ int do_settimeofday(struct timespec *tv)
279272
* done, and then undo it!
280273
*/
281274
nsec -= system_timer->offset() * NSEC_PER_USEC;
282-
nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
283275

284276
wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
285277
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);

‎arch/arm26/kernel/time.c‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
#include <asm/irq.h>
3434
#include <asm/ioc.h>
3535

36-
extern unsigned long wall_jiffies;
37-
3836
/* this needs a better home */
3937
DEFINE_SPINLOCK(rtc_lock);
4038

@@ -136,16 +134,11 @@ void do_gettimeofday(struct timeval *tv)
136134
{
137135
unsigned long flags;
138136
unsigned long seq;
139-
unsigned long usec, sec, lost;
137+
unsigned long usec, sec;
140138

141139
do {
142140
seq = read_seqbegin_irqsave(&xtime_lock, flags);
143141
usec = gettimeoffset();
144-
145-
lost = jiffies - wall_jiffies;
146-
if (lost)
147-
usec += lost * USECS_PER_JIFFY;
148-
149142
sec = xtime.tv_sec;
150143
usec += xtime.tv_nsec / 1000;
151144
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -174,8 +167,7 @@ int do_settimeofday(struct timespec *tv)
174167
* wall time. Discover what correction gettimeofday() would have
175168
* done, and then undo it!
176169
*/
177-
tv->tv_nsec -= 1000 * (gettimeoffset() +
178-
(jiffies - wall_jiffies) * USECS_PER_JIFFY);
170+
tv->tv_nsec -= 1000 * gettimeoffset();
179171

180172
while (tv->tv_nsec < 0) {
181173
tv->tv_nsec += NSEC_PER_SEC;

‎arch/cris/kernel/time.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ int have_rtc; /* used to remember if we have an RTC or not */;
3737

3838
#define TICK_SIZE tick
3939

40-
extern unsigned long wall_jiffies;
4140
extern unsigned long loops_per_jiffy; /* init/main.c */
4241
unsigned long loops_per_usec;
4342

@@ -58,11 +57,6 @@ void do_gettimeofday(struct timeval *tv)
5857
local_irq_save(flags);
5958
local_irq_disable();
6059
usec = do_gettimeoffset();
61-
{
62-
unsigned long lost = jiffies - wall_jiffies;
63-
if (lost)
64-
usec += lost * (1000000 / HZ);
65-
}
6660

6761
/*
6862
* If time_adjust is negative then NTP is slowing the clock
@@ -103,7 +97,6 @@ int do_settimeofday(struct timespec *tv)
10397
* made, and then undo it!
10498
*/
10599
nsec -= do_gettimeoffset() * NSEC_PER_USEC;
106-
nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
107100

108101
wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
109102
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);

‎arch/i386/kernel/time.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ int pit_latch_buggy; /* extern */
7676
unsigned int cpu_khz; /* Detected as we calibrate the TSC */
7777
EXPORT_SYMBOL(cpu_khz);
7878

79-
extern unsigned long wall_jiffies;
80-
8179
DEFINE_SPINLOCK(rtc_lock);
8280
EXPORT_SYMBOL(rtc_lock);
8381

@@ -329,7 +327,6 @@ static int timer_resume(struct sys_device *dev)
329327
do_settimeofday(&ts);
330328
write_seqlock_irqsave(&xtime_lock, flags);
331329
jiffies_64 += sleep_length;
332-
wall_jiffies += sleep_length;
333330
write_sequnlock_irqrestore(&xtime_lock, flags);
334331
touch_softlockup_watchdog();
335332
return 0;

‎arch/ia64/kernel/time.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
#include <asm/sections.h>
3030
#include <asm/system.h>
3131

32-
extern unsigned long wall_jiffies;
33-
3432
volatile int time_keeper_id = 0; /* smp_processor_id() of time-keeper */
3533

3634
#ifdef CONFIG_IA64_DEBUG_IRQ

‎arch/m32r/kernel/time.c‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ extern void send_IPI_allbutself(int, int);
3838
extern void smp_local_timer_interrupt(struct pt_regs *);
3939
#endif
4040

41-
extern unsigned long wall_jiffies;
4241
#define TICK_SIZE (tick_nsec / 1000)
4342

4443
/*
@@ -108,24 +107,17 @@ void do_gettimeofday(struct timeval *tv)
108107
unsigned long max_ntp_tick = tick_usec - tickadj;
109108

110109
do {
111-
unsigned long lost;
112-
113110
seq = read_seqbegin(&xtime_lock);
114111

115112
usec = do_gettimeoffset();
116-
lost = jiffies - wall_jiffies;
117113

118114
/*
119115
* If time_adjust is negative then NTP is slowing the clock
120116
* so make sure not to go into next possible interval.
121117
* Better to lose some accuracy than have time go backwards..
122118
*/
123-
if (unlikely(time_adjust < 0)) {
119+
if (unlikely(time_adjust < 0))
124120
usec = min(usec, max_ntp_tick);
125-
if (lost)
126-
usec += lost * max_ntp_tick;
127-
} else if (unlikely(lost))
128-
usec += lost * tick_usec;
129121

130122
sec = xtime.tv_sec;
131123
usec += (xtime.tv_nsec / 1000);
@@ -158,7 +150,6 @@ int do_settimeofday(struct timespec *tv)
158150
* made, and then undo it!
159151
*/
160152
nsec -= do_gettimeoffset() * NSEC_PER_USEC;
161-
nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
162153

163154
wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
164155
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);

‎arch/m68k/kernel/time.c‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,31 +96,23 @@ void time_init(void)
9696
void do_gettimeofday(struct timeval *tv)
9797
{
9898
unsigned long flags;
99-
extern unsigned long wall_jiffies;
10099
unsigned long seq;
101-
unsigned long usec, sec, lost;
100+
unsigned long usec, sec;
102101
unsigned long max_ntp_tick = tick_usec - tickadj;
103102

104103
do {
105104
seq = read_seqbegin_irqsave(&xtime_lock, flags);
106105

107106
usec = mach_gettimeoffset();
108-
lost = jiffies - wall_jiffies;
109107

110108
/*
111109
* If time_adjust is negative then NTP is slowing the clock
112110
* so make sure not to go into next possible interval.
113111
* Better to lose some accuracy than have time go backwards..
114112
*/
115-
if (unlikely(time_adjust < 0)) {
113+
if (unlikely(time_adjust < 0))
116114
usec = min(usec, max_ntp_tick);
117115

118-
if (lost)
119-
usec += lost * max_ntp_tick;
120-
}
121-
else if (unlikely(lost))
122-
usec += lost * tick_usec;
123-
124116
sec = xtime.tv_sec;
125117
usec += xtime.tv_nsec/1000;
126118
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -141,7 +133,6 @@ int do_settimeofday(struct timespec *tv)
141133
{
142134
time_t wtm_sec, sec = tv->tv_sec;
143135
long wtm_nsec, nsec = tv->tv_nsec;
144-
extern unsigned long wall_jiffies;
145136

146137
if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
147138
return -EINVAL;
@@ -153,8 +144,7 @@ int do_settimeofday(struct timespec *tv)
153144
* Discover what correction gettimeofday
154145
* would have done, and then undo it!
155146
*/
156-
nsec -= 1000 * (mach_gettimeoffset() +
157-
(jiffies - wall_jiffies) * (1000000 / HZ));
147+
nsec -= 1000 * mach_gettimeoffset();
158148

159149
wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
160150
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);

‎arch/m68knommu/kernel/time.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
#define TICK_SIZE (tick_nsec / 1000)
2828

29-
extern unsigned long wall_jiffies;
30-
3129

3230
static inline int set_rtc_mmss(unsigned long nowtime)
3331
{
@@ -124,15 +122,12 @@ void time_init(void)
124122
void do_gettimeofday(struct timeval *tv)
125123
{
126124
unsigned long flags;
127-
unsigned long lost, seq;
125+
unsigned long seq;
128126
unsigned long usec, sec;
129127

130128
do {
131129
seq = read_seqbegin_irqsave(&xtime_lock, flags);
132130
usec = mach_gettimeoffset ? mach_gettimeoffset() : 0;
133-
lost = jiffies - wall_jiffies;
134-
if (lost)
135-
usec += lost * (1000000 / HZ);
136131
sec = xtime.tv_sec;
137132
usec += (xtime.tv_nsec / 1000);
138133
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));

‎arch/mips/kernel/time.c‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
/*
4848
* forward reference
4949
*/
50-
extern volatile unsigned long wall_jiffies;
51-
5250
DEFINE_SPINLOCK(rtc_lock);
5351

5452
/*
@@ -159,7 +157,6 @@ void (*mips_hpt_init)(unsigned int);
159157
void do_gettimeofday(struct timeval *tv)
160158
{
161159
unsigned long seq;
162-
unsigned long lost;
163160
unsigned long usec, sec;
164161
unsigned long max_ntp_tick;
165162

@@ -168,8 +165,6 @@ void do_gettimeofday(struct timeval *tv)
168165

169166
usec = do_gettimeoffset();
170167

171-
lost = jiffies - wall_jiffies;
172-
173168
/*
174169
* If time_adjust is negative then NTP is slowing the clock
175170
* so make sure not to go into next possible interval.
@@ -178,11 +173,7 @@ void do_gettimeofday(struct timeval *tv)
178173
if (unlikely(time_adjust < 0)) {
179174
max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj;
180175
usec = min(usec, max_ntp_tick);
181-
182-
if (lost)
183-
usec += lost * max_ntp_tick;
184-
} else if (unlikely(lost))
185-
usec += lost * (USEC_PER_SEC / HZ);
176+
}
186177

187178
sec = xtime.tv_sec;
188179
usec += (xtime.tv_nsec / 1000);
@@ -217,7 +208,6 @@ int do_settimeofday(struct timespec *tv)
217208
* made, and then undo it!
218209
*/
219210
nsec -= do_gettimeoffset() * NSEC_PER_USEC;
220-
nsec -= (jiffies - wall_jiffies) * tick_nsec;
221211

222212
wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
223213
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);

0 commit comments

Comments
 (0)