public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Serge Belyshev <belyshev@depni.sinp.msu.ru>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [RT] fix delay in do_vgettimeofday() in arch/x86_64/kernel/vsyscall.c
Date: Fri, 09 Dec 2005 22:38:53 +0300	[thread overview]
Message-ID: <87d5k6ukky.fsf@foo.vault.bofh.ru> (raw)



There are occasional very very long (30..60 sec) delays happening when calling
gettimeofday() vsyscall on x86_64 with 2.6.14-rt22 kernel.

These delays come from while() looping over invalid data that are
going to be discarded by seqlock.



 arch/x86_64/kernel/vsyscall.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: linux/arch/x86_64/kernel/vsyscall.c
===================================================================
--- linux.orig/arch/x86_64/kernel/vsyscall.c
+++ linux/arch/x86_64/kernel/vsyscall.c
@@ -111,14 +111,15 @@ static force_inline void do_vgettimeofda
 
 		/* add nsec offset to wall_time_tv */
 		*tv = __vsyscall_gtod_data.wall_time_tv;
-		do_div(nsec_delta, NSEC_PER_USEC);
-		tv->tv_usec += (unsigned long) nsec_delta;
-
-		while (tv->tv_usec > USEC_PER_SEC) {
-			tv->tv_sec += 1;
-			tv->tv_usec -= USEC_PER_SEC;
-		}
 	} while (read_seqretry(&__vsyscall_gtod_lock, seq));
+
+	do_div(nsec_delta, NSEC_PER_USEC);
+	tv->tv_usec += (unsigned long) nsec_delta;
+
+	while (tv->tv_usec > USEC_PER_SEC) {
+		tv->tv_sec += 1;
+		tv->tv_usec -= USEC_PER_SEC;
+	}
 }
 
 /*

             reply	other threads:[~2005-12-09 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-09 19:38 Serge Belyshev [this message]
2005-12-10  2:33 ` [RT] fix delay in do_vgettimeofday() in arch/x86_64/kernel/vsyscall.c john stultz
2005-12-10 20:56   ` Fernando Lopez-Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d5k6ukky.fsf@foo.vault.bofh.ru \
    --to=belyshev@depni.sinp.msu.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox