mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ray Lee" <ray-lk@madrabbit.org>
To: "Andrea Arcangeli" <andrea@suse.de>
Cc: "Ingo Molnar" <mingo@elte.hu>,
	"Jesper Juhl" <jesper.juhl@gmail.com>,
	"Roman Zippel" <zippel@linux-m68k.org>,
	linux-kernel@vger.kernel.org,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"John Stultz" <johnstul@us.ibm.com>,
	"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [patch, v2.6.22-rc6] sys_time() speedup
Date: Tue, 26 Jun 2007 10:13:31 -0700	[thread overview]
Message-ID: <2c0942db0706261013pd1010b5iebfa912e7c9f8c9c@mail.gmail.com> (raw)
In-Reply-To: <20070626164907.GF7059@v2.random>

On 6/26/07, Andrea Arcangeli <andrea@suse.de> wrote:
> On Tue, Jun 26, 2007 at 06:18:57PM +0200, Ingo Molnar wrote:
> > My patch improves MySQL wall-clock performance by ~10% on a dual-core
> > box [see the numbers i cited in my initial mail, they were ran on a T60
> > with a 1.83 GHz Core2Duo] and by 7% on an 8-way box:
>
> mysql isn't froznen in stone like some commercial db, you can look into its
> source, the testsuite isn't either I guess. Did you ask yourself at
> least once why it's calling time() so many times per second? The
> timestamp sql type should always trigger gettimeofday calls AFIK.
>
> If there's a good reason to call time so frequently in an important
> app like mysql, then your patch sure is a good idea, but at first
> glance it looks fishy that time is so performance critical.

It's not an unreasonable expectation (from userspace's point of view)
that the simpler sys_time() system call would run faster than
gettimeofday. I suspect that this may be the case on other platforms.

However, your entire argument seems to be "It helps userspace run
faster? Weird. It shouldn't. They must be doing something wrong,
therefore the patch is stupid."

If that is your argument, then it's bogus. The bottom line is that
code, deployed today, significantly and impressively benefits from the
patch. And it's not a microbenchmark, that ignores the effect on the
rest of the system. Ingo said that both MySQL and X are improved by
this, so between the two of them that covers most every desktop system
and many servers.

> I'm not objecting the patch itself, if there's a legitimate reason to
> call time so frequently that's sure a fine optimization despite the
> branch in gettimeofday, but I'm asking why time is called so many
> times on this specific workload, because I'm fairly certain that in
> average (desktop and server) gettimeofday is called much more
> frequently

You're absolutely correct, gettimeofday *is* called much more
frequently. But not enough to outweigh the gains from sys_time
improvements.

> and if it was up to me to tell, I would expect time
> microoptimizations to result in irrelevant performance
> differences. Infact I seem to recall that even other commercial dbs
> calls tends to call floods of gettimeofday while I can't recall any
> time in the strace output. So unless there is a legitimate reason to
> call time() dozen thousand times per second,

(Why does this argument always rear its head on topics in timekeeping?)

Userspace does, whether you or I think it is legitimate or not, and
that's the reality we need to deal with. Further, I'd argue that it
*does* make sense, as sys_time() should be as cheap or cheaper than
gettimeofday(), and bottom line, userspace code needs to know the time
for lots of reasonable reasons.

> if it was my choice, I
> would prefer to have gettimeofday as fast as it can be. Not that a
> branch will make any measurable difference, but still that would be my
> choice.

Then you'd be penny-wise and pound-foolish, as the saying goes. Said
un-idiomatically, you're optimizing from a microbenchmark point of
view, which is not guaranteed to always be a win.

Ray

  reply	other threads:[~2007-06-26 17:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-25 20:06 Ingo Molnar
2007-06-25 21:09 ` Roman Zippel
2007-06-25 21:17   ` Jesper Juhl
2007-06-25 22:00     ` Roman Zippel
2007-06-25 22:20       ` Jesper Juhl
2007-06-25 22:49         ` Roman Zippel
2007-06-26 16:18         ` Ingo Molnar
2007-06-26 16:39           ` Roman Zippel
2007-06-26 16:49           ` Andrea Arcangeli
2007-06-26 17:13             ` Ray Lee [this message]
2007-06-27  0:15               ` Andrea Arcangeli
2007-06-26 17:08           ` Roman Zippel
2007-06-26 17:35             ` Andrew Morton
2007-06-25 22:15   ` Andrew Morton
2007-06-26  2:20     ` Stephen Rothwell
2007-06-26 15:26     ` Ingo Molnar
2007-06-26 17:14       ` Andrew Morton
2007-06-27  0:22         ` Andrea Arcangeli
2007-06-26 15:43     ` Andrea Arcangeli
2007-06-26 17:36     ` Andrew Morton
2007-06-25 22:02 ` Eric Dumazet
2007-06-26  0:22 ` Mark Lord
2007-06-26 14:58   ` Ingo Molnar
2007-06-26 16:59     ` john stultz

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=2c0942db0706261013pd1010b5iebfa912e7c9f8c9c@mail.gmail.com \
    --to=ray-lk@madrabbit.org \
    --cc=akpm@linux-foundation.org \
    --cc=andrea@suse.de \
    --cc=jesper.juhl@gmail.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=zippel@linux-m68k.org \
    /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®