Commit a016a5bd authored by Thomas Gleixner's avatar Thomas Gleixner Committed by John Stultz

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: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 7c032df5
...@@ -407,18 +407,19 @@ ktime_t ktime_get(void) ...@@ -407,18 +407,19 @@ ktime_t ktime_get(void)
{ {
struct timekeeper *tk = &tk_core.timekeeper; struct timekeeper *tk = &tk_core.timekeeper;
unsigned int seq; unsigned int seq;
s64 secs, nsecs; ktime_t base;
s64 nsecs;
WARN_ON(timekeeping_suspended); WARN_ON(timekeeping_suspended);
do { do {
seq = read_seqcount_begin(&tk_core.seq); seq = read_seqcount_begin(&tk_core.seq);
secs = tk->xtime_sec + tk->wall_to_monotonic.tv_sec; base = tk->base_mono;
nsecs = timekeeping_get_ns(tk) + tk->wall_to_monotonic.tv_nsec; nsecs = timekeeping_get_ns(tk);
} while (read_seqcount_retry(&tk_core.seq, seq)); } while (read_seqcount_retry(&tk_core.seq, seq));
return ktime_set(secs, nsecs); return ktime_add_ns(base, nsecs);
} }
EXPORT_SYMBOL_GPL(ktime_get); EXPORT_SYMBOL_GPL(ktime_get);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment