[PATCH] time: Remove xtime_cache

From: tip-bot for john stultz
Date: Mon Oct 05 2009 - 07:54:53 EST


Commit-ID: 7bc7d637452383d56ba4368d4336b0dde1bb476d
Gitweb: http://git.kernel.org/tip/7bc7d637452383d56ba4368d4336b0dde1bb476d
Author: john stultz <johnstul@xxxxxxxxxx>
AuthorDate: Fri, 2 Oct 2009 16:24:15 -0700
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Mon, 5 Oct 2009 13:52:02 +0200

time: Remove xtime_cache

With the prior logarithmic time accumulation patch, xtime will now
always be within one "tick" of the current time, instead of
possibly half a second off.

This removes the need for the xtime_cache value, which always
stored the time at the last interrupt, so this patch cleans that up
removing the xtime_cache related code.

This is a bit simpler, but still could use some wider testing.

Signed-off-by: John Stultz <johnstul@xxxxxxxxxx>
Acked-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Reviewed-by: John Kacur <jkacur@xxxxxxxxxx>
Cc: Clark Williams <williams@xxxxxxxxxx>
Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
LKML-Reference: <1254525855.7741.95.camel@xxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
kernel/time.c | 1 -
kernel/time/timekeeping.c | 20 ++------------------
2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/kernel/time.c b/kernel/time.c
index 35d1aaa..01944b5 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -136,7 +136,6 @@ static inline void warp_clock(void)
write_atomic_seqlock_irq(&xtime_lock);
wall_to_monotonic.tv_sec -= sys_tz.tz_minuteswest * 60;
xtime.tv_sec += sys_tz.tz_minuteswest * 60;
- update_xtime_cache(0);
write_atomic_sequnlock_irq(&xtime_lock);
clock_was_set();
}
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 4630874..4a0920d 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -48,16 +48,8 @@ static unsigned long total_sleep_time; /* seconds */
/* flag for if timekeeping is suspended */
int __read_mostly timekeeping_suspended;

-static struct timespec xtime_cache __attribute__ ((aligned (16)));
-void update_xtime_cache(u64 nsec)
-{
- xtime_cache = xtime;
- timespec_add_ns(&xtime_cache, nsec);
-}
-
struct clocksource *clock;

-
#ifdef CONFIG_GENERIC_TIME
/**
* clocksource_forward_now - update clock to the current time
@@ -233,7 +225,6 @@ int do_settimeofday(struct timespec *tv)

xtime = *tv;

- update_xtime_cache(0);

clock->error = 0;
ntp_clear();
@@ -435,7 +426,6 @@ void __init timekeeping_init(void)
xtime.tv_nsec = 0;
set_normalized_timespec(&wall_to_monotonic,
-xtime.tv_sec, -xtime.tv_nsec);
- update_xtime_cache(0);
total_sleep_time = 0;
write_atomic_sequnlock_irqrestore(&xtime_lock, flags);
}
@@ -467,7 +457,6 @@ static int timekeeping_resume(struct sys_device *dev)
wall_to_monotonic.tv_sec -= sleep_length;
total_sleep_time += sleep_length;
}
- update_xtime_cache(0);
/* re-base the last cycle value */
clock->cycle_last = 0;
clock->cycle_last = clocksource_read(clock);
@@ -608,7 +597,6 @@ static void clocksource_adjust(s64 offset)
(NTP_SCALE_SHIFT - clock->shift);
}

-
/**
* logarithmic_accumulation - shifted accumulation of cycles
*
@@ -652,7 +640,6 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
return offset;
}

-
/**
* update_wall_time - Uses the current clocksource to increment the wall time
*
@@ -661,7 +648,6 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
void update_wall_time(void)
{
cycle_t offset;
- u64 nsecs;
int shift = 0, maxshift;

/* Make sure we're fully resumed: */
@@ -725,8 +711,6 @@ void update_wall_time(void)
clock->xtime_nsec -= (s64)xtime.tv_nsec << clock->shift;
clock->error += clock->xtime_nsec << (NTP_SCALE_SHIFT - clock->shift);

- update_xtime_cache(cyc2ns(clock, offset));
-
/* check to see if there is a new clocksource to use */
change_clocksource();
update_vsyscall(&xtime, clock);
@@ -761,7 +745,7 @@ void monotonic_to_bootbased(struct timespec *ts)

unsigned long get_seconds(void)
{
- return xtime_cache.tv_sec;
+ return xtime.tv_sec;
}
EXPORT_SYMBOL(get_seconds);

@@ -774,7 +758,7 @@ struct timespec current_kernel_time(void)
do {
seq = read_atomic_seqbegin(&xtime_lock);

- now = xtime_cache;
+ now = xtime;
} while (read_atomic_seqretry(&xtime_lock, seq));

return now;
--
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/