summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorjohn stultz <johnstul@us.ibm.com>2007-07-24 17:47:43 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-25 10:09:20 -0700
commit2c6b47de17c75d553de3e2fb426d8298d2074585 (patch)
treec8edc3d727d85cb3e1c043583c350a04a133e1a3 /kernel
parent0de085bb474f64e4fdb2f1ff3268590792648c7b (diff)
Cleanup non-arch xtime uses, use get_seconds() or current_kernel_time().
This avoids use of the kernel-internal "xtime" variable directly outside of the actual time-related functions. Instead, use the helper functions that we already have available to us. This doesn't actually change any behaviour, but this will allow us to fix the fact that "xtime" isn't updated very often with CONFIG_NO_HZ (because much of the realtime information is maintained as separate offsets to 'xtime'), which has caused interfaces that use xtime directly to get a time that is out of sync with the real-time clock by up to a third of a second or so. Signed-off-by: John Stultz <johnstul@us.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/acct.c2
-rw-r--r--kernel/hrtimer.c2
-rw-r--r--kernel/time.c16
-rw-r--r--kernel/time/timekeeping.c16
-rw-r--r--kernel/tsacct.c2
5 files changed, 19 insertions, 19 deletions
diff --git a/kernel/acct.c b/kernel/acct.c
index 70d0d88e555..24f0f8b2ba7 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -468,7 +468,7 @@ static void do_acct_process(struct file *file)
}
#endif
do_div(elapsed, AHZ);
- ac.ac_btime = xtime.tv_sec - elapsed;
+ ac.ac_btime = get_seconds() - elapsed;
/* we really need to bite the bullet and change layout */
ac.ac_uid = current->uid;
ac.ac_gid = current->gid;
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index eb1ddebd2c0..a7bb05e6cb6 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -144,7 +144,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
#ifdef CONFIG_NO_HZ
getnstimeofday(&xts);
#else
- xts = xtime;
+ xts = current_kernel_time();
#endif
tom = wall_to_monotonic;
} while (read_seqretry(&xtime_lock, seq));
diff --git a/kernel/time.c b/kernel/time.c
index 5b81da08bbd..2289a8d6831 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -215,22 +215,6 @@ asmlinkage long sys_adjtimex(struct timex __user *txc_p)
return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret;
}
-inline struct timespec current_kernel_time(void)
-{
- struct timespec now;
- unsigned long seq;
-
- do {
- seq = read_seqbegin(&xtime_lock);
-
- now = xtime;
- } while (read_seqretry(&xtime_lock, seq));
-
- return now;
-}
-
-EXPORT_SYMBOL(current_kernel_time);
-
/**
* current_fs_time - Return FS time
* @sb: Superblock.
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 88c81026e00..07a3f1420c2 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -509,3 +509,19 @@ void monotonic_to_bootbased(struct timespec *ts)
{
ts->tv_sec += total_sleep_time;
}
+
+struct timespec current_kernel_time(void)
+{
+ struct timespec now;
+ unsigned long seq;
+
+ do {
+ seq = read_seqbegin(&xtime_lock);
+
+ now = xtime;
+ } while (read_seqretry(&xtime_lock, seq));
+
+ return now;
+}
+
+EXPORT_SYMBOL(current_kernel_time);
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 658f638c402..c122131a122 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -39,7 +39,7 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
ac_etime = timespec_to_ns(&ts);
do_div(ac_etime, NSEC_PER_USEC);
stats->ac_etime = ac_etime;
- stats->ac_btime = xtime.tv_sec - ts.tv_sec;
+ stats->ac_btime = get_seconds() - ts.tv_sec;
if (thread_group_leader(tsk)) {
stats->ac_exitcode = tsk->exit_code;
if (tsk->flags & PF_FORKNOEXEC)