diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2007-05-02 13:27:11 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:11 -0400 |
commit | 272a3713bb9e302e0455c894c41180a482d2c8a3 (patch) | |
tree | 2dad036c75c0523db5f5f0f9618f4f3b9f21e28c /arch/x86_64 | |
parent | bd8559c38ee5be40ce2c57a80fd3c3e978cca267 (diff) |
[PATCH] x86-64: fix vtime() vsyscall
There is a tiny probability that the return value from vtime(time_t *t) is
Signed-off-by: Andi Kleen <ak@suse.de>
different than the value stored in *t
Using a temporary variable solves the problem and gives a faster code.
17: 48 85 ff test %rdi,%rdi
1a: 48 8b 05 00 00 00 00 mov 0(%rip),%rax #
__vsyscall_gtod_data.wall_time_tv.tv_sec
21: 74 03 je 26
23: 48 89 07 mov %rax,(%rdi)
26: c9 leaveq
27: c3 retq
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Diffstat (limited to 'arch/x86_64')
-rw-r--r-- | arch/x86_64/kernel/vsyscall.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c index d14cbb3e0ebe..ba330f870679 100644 --- a/arch/x86_64/kernel/vsyscall.c +++ b/arch/x86_64/kernel/vsyscall.c | |||
@@ -156,11 +156,13 @@ int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz) | |||
156 | * unlikely */ | 156 | * unlikely */ |
157 | time_t __vsyscall(1) vtime(time_t *t) | 157 | time_t __vsyscall(1) vtime(time_t *t) |
158 | { | 158 | { |
159 | time_t result; | ||
159 | if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) | 160 | if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) |
160 | return time_syscall(t); | 161 | return time_syscall(t); |
161 | else if (t) | 162 | result = __vsyscall_gtod_data.wall_time_tv.tv_sec; |
162 | *t = __vsyscall_gtod_data.wall_time_tv.tv_sec; | 163 | if (t) |
163 | return __vsyscall_gtod_data.wall_time_tv.tv_sec; | 164 | *t = result; |
165 | return result; | ||
164 | } | 166 | } |
165 | 167 | ||
166 | /* Fast way to get current CPU and node. | 168 | /* Fast way to get current CPU and node. |