Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d0aff6e6f4e54f79f9c89d147d371bad384454e9 Commit: d0aff6e6f4e54f79f9c89d147d371bad384454e9 Parent: d8902bfcacde6001e1b11bb06137c3bae3ae52d0 Author: john stultz <[EMAIL PROTECTED]> AuthorDate: Mon May 21 14:31:52 2007 +0200 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Mon May 21 09:56:57 2007 -0700
x86_64: vsyscall time() fix The vsyscall time() function basically returns the second portion of xtime directly. This however means that there is about a ticks worth of time each second where time() will return a second value less then what gettimeofday() does. Additionally, this window where vtime() is behind vgettimeofday() grows when dynticks is enabled, so its probably good to get this in before dynticks lands. Big thanks to Sripathi for noticing this issue and creating a test case to work with! This patch changes the vtime() implemenation to call vgettimeofday(), much as syscall time() implementation calls gettimeofday(). 2.6.21 stable candidate too Signed-off-by: John Stultz <[EMAIL PROTECTED]> Signed-off-by: Andi Kleen <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- arch/x86_64/kernel/vsyscall.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c index 51d4c6f..57660d5 100644 --- a/arch/x86_64/kernel/vsyscall.c +++ b/arch/x86_64/kernel/vsyscall.c @@ -175,10 +175,13 @@ int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz) * unlikely */ time_t __vsyscall(1) vtime(time_t *t) { + struct timeval tv; time_t result; if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) return time_syscall(t); - result = __vsyscall_gtod_data.wall_time_sec; + + vgettimeofday(&tv, 0); + result = tv.tv_sec; if (t) *t = result; return result; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html