Commit 19832d24 authored by David S. Miller's avatar David S. Miller

sparc: Several small VDSO vclock_gettime.c improvements.

Almost entirely borrowed from the x86 code.

Main improvement is to avoid having to initialize
ts->tv_nsec to zero before the sequence loops, by
expanding timespec_add_ns().
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ecd4c19f
...@@ -138,7 +138,6 @@ notrace static __always_inline int do_realtime(struct vvar_data *vvar, ...@@ -138,7 +138,6 @@ notrace static __always_inline int do_realtime(struct vvar_data *vvar,
unsigned long seq; unsigned long seq;
u64 ns; u64 ns;
ts->tv_nsec = 0;
do { do {
seq = vvar_read_begin(vvar); seq = vvar_read_begin(vvar);
ts->tv_sec = vvar->wall_time_sec; ts->tv_sec = vvar->wall_time_sec;
...@@ -147,7 +146,8 @@ notrace static __always_inline int do_realtime(struct vvar_data *vvar, ...@@ -147,7 +146,8 @@ notrace static __always_inline int do_realtime(struct vvar_data *vvar,
ns >>= vvar->clock.shift; ns >>= vvar->clock.shift;
} while (unlikely(vvar_read_retry(vvar, seq))); } while (unlikely(vvar_read_retry(vvar, seq)));
timespec_add_ns(ts, ns); ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns);
ts->tv_nsec = ns;
return 0; return 0;
} }
...@@ -158,7 +158,6 @@ notrace static __always_inline int do_monotonic(struct vvar_data *vvar, ...@@ -158,7 +158,6 @@ notrace static __always_inline int do_monotonic(struct vvar_data *vvar,
unsigned long seq; unsigned long seq;
u64 ns; u64 ns;
ts->tv_nsec = 0;
do { do {
seq = vvar_read_begin(vvar); seq = vvar_read_begin(vvar);
ts->tv_sec = vvar->monotonic_time_sec; ts->tv_sec = vvar->monotonic_time_sec;
...@@ -167,7 +166,8 @@ notrace static __always_inline int do_monotonic(struct vvar_data *vvar, ...@@ -167,7 +166,8 @@ notrace static __always_inline int do_monotonic(struct vvar_data *vvar,
ns >>= vvar->clock.shift; ns >>= vvar->clock.shift;
} while (unlikely(vvar_read_retry(vvar, seq))); } while (unlikely(vvar_read_retry(vvar, seq)));
timespec_add_ns(ts, ns); ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns);
ts->tv_nsec = ns;
return 0; return 0;
} }
......
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