mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefani Seibold <stefani@seibold.net>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	x86@kernel.org, tglx@linutronix.de, mingo@redhat.com,
	ak@linux.intel.com, aarcange@redhat.com, john.stultz@linaro.org,
	luto@amacapital.net, xemul@parallels.com, gorcunov@openvz.org,
	andriy.shevchenko@linux.intel.com,
	Martin.Runge@rohde-schwarz.com, Andreas.Brief@rohde-schwarz.com
Subject: Re: [PATCH 6/8] cleanup __vdso_gettimeofday
Date: Sun, 02 Feb 2014 17:02:52 +0100	[thread overview]
Message-ID: <1391356972.1158.4.camel@wall-e.seibold.net> (raw)
In-Reply-To: <f57bdfaa-3b88-4e27-adf0-21033448c1c6@email.android.com>

On Sun, 2014-02-02 at 07:43 -0800, H. Peter Anvin wrote:
> Even reading the timezone via gettimeofday is the uncommon case... never mind only the timezome.  Whatever you do please don't slow down the common case.
> 
> On February 2, 2014 3:27:13 AM PST, stefani@seibold.net wrote:
> >From: Stefani Seibold <stefani@seibold.net>
> >
> >This patch do a little cleanup for the __vdso_gettimeofday() function.
> >
> >It kick out an unneeded ret local variable and makes the code faster if
> >only the timezone is needed.
> >
> >Signed-off-by: Stefani Seibold <stefani@seibold.net>
> >---
> > arch/x86/vdso/vclock_gettime.c | 7 ++-----
> > 1 file changed, 2 insertions(+), 5 deletions(-)
> >
> >diff --git a/arch/x86/vdso/vclock_gettime.c
> >b/arch/x86/vdso/vclock_gettime.c
> >index 743f277..bf969a0 100644
> >--- a/arch/x86/vdso/vclock_gettime.c
> >+++ b/arch/x86/vdso/vclock_gettime.c
> >@@ -259,13 +259,12 @@ int clock_gettime(clockid_t, struct timespec *)
> > 
> >notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone
> >*tz)
> > {
> >-	long ret = VCLOCK_NONE;
> >-
> > 	if (likely(tv != NULL)) {
> > 		BUILD_BUG_ON(offsetof(struct timeval, tv_usec) !=
> > 			     offsetof(struct timespec, tv_nsec) ||
> > 			     sizeof(*tv) != sizeof(struct timespec));
> >-		ret = do_realtime((struct timespec *)tv);
> >+		if (do_realtime((struct timespec *)tv) == VCLOCK_NONE)
> >+			return vdso_fallback_gtod(tv, tz);
> > 		tv->tv_usec /= 1000;
> > 	}
> > 	if (unlikely(tz != NULL)) {
> >@@ -274,8 +273,6 @@ notrace int __vdso_gettimeofday(struct timeval *tv,
> >struct timezone *tz)
> > 		tz->tz_dsttime = gtod->sys_tz.tz_dsttime;
> > 	}
> > 
> >-	if (ret == VCLOCK_NONE)
> >-		return vdso_fallback_gtod(tv, tz);
> > 	return 0;
> > }
> > int gettimeofday(struct timeval *, struct timezone *)
> 

I don't see where i slow down the common case! It is exactly the same
behaviour as the original code. Only in the uncommon case where the tv
== NULL and tz != NULL is a bit faster.



  reply	other threads:[~2014-02-02 16:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-02 11:27 [PATCH 0/8] Add 32 bit VDSO time function support stefani
2014-02-02 11:27 ` [PATCH 1/8] Make vsyscall_gtod_data handling x86 generic stefani
2014-02-02 11:27 ` [PATCH 2/8] Add new func _install_special_mapping() to mmap.c stefani
2014-02-02 11:27 ` [PATCH 3/8] revamp vclock_gettime.c stefani
2014-02-02 16:39   ` Andy Lutomirski
2014-02-02 11:27 ` [PATCH 4/8] vclock_gettime.c __vdso_clock_gettime cleanup stefani
2014-02-02 16:38   ` Andy Lutomirski
2014-02-02 11:27 ` [PATCH 5/8] replace VVAR(vsyscall_gtod_data) by gtod macro stefani
2014-02-02 16:42   ` Andy Lutomirski
2014-02-02 11:27 ` [PATCH 6/8] cleanup __vdso_gettimeofday stefani
2014-02-02 15:43   ` H. Peter Anvin
2014-02-02 16:02     ` Stefani Seibold [this message]
2014-02-02 16:37   ` Andy Lutomirski
2014-02-02 11:27 ` [PATCH 7/8] Add 32 bit VDSO time support for 32 bit kernel stefani
2014-02-02 16:46   ` Andy Lutomirski
2014-02-02 21:39     ` Stefani Seibold
2014-02-03  0:12       ` Andy Lutomirski
2014-02-03  7:44         ` Stefani Seibold
2014-02-03 16:36           ` Andy Lutomirski
2014-02-03 22:01             ` Stefani Seibold
2014-02-03 22:04               ` Andy Lutomirski
2014-02-04  6:25                 ` Stefani Seibold
2014-02-02 11:27 ` [PATCH 8/8] Add 32 bit VDSO time support for 64 " stefani

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=1391356972.1158.4.camel@wall-e.seibold.net \
    --to=stefani@seibold.net \
    --cc=Andreas.Brief@rohde-schwarz.com \
    --cc=Martin.Runge@rohde-schwarz.com \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gorcunov@openvz.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xemul@parallels.com \
    /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

all inboxes | Powered by JetHome®