Skip to content
Snippets Groups Projects
Commit 20082208 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Revert "sys_time() speedup"


This basically reverts commit 4e44f349,
while waiting for it to be re-done more completely.  There are cases of
people mixing "time()" with higher-resolution time sources, and we need
to take the nanosecond offsets into account.

Ingo has a patch that does that, but it's still under some discussion.
In the meantime, just revert back to the old simple situation of just
doing the whole exact timesource calculations.

But rather than using do_gettimeofday(), use the internal nanosecond
resolution getnstimeofday(), which at least avoids one unnecessary
conversion (since we really don't care about whether the fractional
seconds are nanoseconds or microseconds - we'll just throw them away).

Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1d4ec7b1
No related branches found
No related tags found
No related merge requests found
...@@ -57,17 +57,14 @@ EXPORT_SYMBOL(sys_tz); ...@@ -57,17 +57,14 @@ EXPORT_SYMBOL(sys_tz);
*/ */
asmlinkage long sys_time(time_t __user * tloc) asmlinkage long sys_time(time_t __user * tloc)
{ {
/* time_t i;
* We read xtime.tv_sec atomically - it's updated struct timespec tv;
* atomically by update_wall_time(), so no need to
* even read-lock the xtime seqlock:
*/
time_t i = xtime.tv_sec;
smp_rmb(); /* sys_time() results are coherent */ getnstimeofday(&tv);
i = tv.tv_sec;
if (tloc) { if (tloc) {
if (put_user(i, tloc)) if (put_user(i,tloc))
i = -EFAULT; i = -EFAULT;
} }
return i; return i;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment