aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-07-16 17:04:12 -0400
committerJohn Stultz <john.stultz@linaro.org>2014-07-23 13:17:58 -0400
commita016a5bd62e29a738531d9d4d925037a1fdb52f5 (patch)
treefae4bd36497978838b685ffa0e3a274673716ef1
parent7c032df5570388044b4efda3d9f4d2ffb96a3116 (diff)
timekeeping: Use ktime_t based data for ktime_get()
Speed up ktime_get() by using ktime_t based data. Text size shrinks by 64 bytes on x8664. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r--kernel/time/timekeeping.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 86a92476c027..d5be1425cc03 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -407,18 +407,19 @@ ktime_t ktime_get(void)
407{ 407{
408 struct timekeeper *tk = &tk_core.timekeeper; 408 struct timekeeper *tk = &tk_core.timekeeper;
409 unsigned int seq; 409 unsigned int seq;
410 s64 secs, nsecs; 410 ktime_t base;
411 s64 nsecs;
411 412
412 WARN_ON(timekeeping_suspended); 413 WARN_ON(timekeeping_suspended);
413 414
414 do { 415 do {
415 seq = read_seqcount_begin(&tk_core.seq); 416 seq = read_seqcount_begin(&tk_core.seq);
416 secs = tk->xtime_sec + tk->wall_to_monotonic.tv_sec; 417 base = tk->base_mono;
417 nsecs = timekeeping_get_ns(tk) + tk->wall_to_monotonic.tv_nsec; 418 nsecs = timekeeping_get_ns(tk);
418 419
419 } while (read_seqcount_retry(&tk_core.seq, seq)); 420 } while (read_seqcount_retry(&tk_core.seq, seq));
420 421
421 return ktime_set(secs, nsecs); 422 return ktime_add_ns(base, nsecs);
422} 423}
423EXPORT_SYMBOL_GPL(ktime_get); 424EXPORT_SYMBOL_GPL(ktime_get);
424 425