From: Andi Kleen <ak@suse.de>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Chuck Ebbert <76306.1226@compuserve.com>,
Ingo Molnar <mingo@elte.hu>, Jakub Jelinek <jakub@redhat.com>,
Roland McGrath <roland@redhat.com>,
Ulrich Drepper <drepper@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC, patch] i386: vgetcpu(), take 2
Date: Wed, 21 Jun 2006 19:50:47 +0200 [thread overview]
Message-ID: <200606211950.47529.ak@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0606211022300.5498@g5.osdl.org>
On Wednesday 21 June 2006 19:27, Linus Torvalds wrote:
>
> On Wed, 21 Jun 2006, Andi Kleen wrote:
> >
> > My measurements show different - i get 60+ cycles on K8 and 150+ cycles
> > on P4. That is with a full vsyscall around it. However it is still
> > far better than CPUID, however slower than RDTSCP on those CPUs that support it.
> >
> > I changed the CPUID fallback path to use LSL on x86-64
>
> One note of warning:
>
> Playing "clever games" has a real tendency to suck badly eventually. I'm
> betting LSL is pretty damn low on any list of instructions to be optimized
> by the CPU core, so it would tend to always be microcoded, while other ops
> might get faster.
Any way we use to get the current CPU number is microcoded.
Unless RDTSCP and CPUID LSL is not defined to flush any pipelines fortunately.
And with the cache it is not THAT critical.
> > Measuring this way is a bad idea because you get far too much
> > noise from the RDTSCs. Usually you need to put a a few thousands entry
> > loop inside the RDTSCP and devide the result by the loop count
>
> And measuring that way isn't perfect either, because it tends to show you
> how well an instruction works in that particular instruction mix, but not
> necessarily in real life.
>
> Benchmarking single instructions is simply damn hard. It's often better to
> try to find a real load where that particular sequence is important enough
> to be measurable at all, and then try the alternatives. Not perfect
> either, but if you can't find such a load, maybe you shouldn't be doing it
> in the first place.. And if you _can_ find such a real load, at least you
> measured something that was actually real.
I benchmarked it in a faithful simulation of a x86-64 vsyscall
-Andi
next prev parent reply other threads:[~2006-06-21 17:50 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-21 12:24 [RFC, patch] i386: vgetcpu(), take 2 Chuck Ebbert
2006-06-21 17:14 ` Andi Kleen
2006-06-21 17:27 ` Linus Torvalds
2006-06-21 17:50 ` Andi Kleen [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-06-22 12:23 Chuck Ebbert
2006-06-22 12:44 ` Andi Kleen
2006-06-21 7:27 Chuck Ebbert
2006-06-21 8:15 ` Ingo Molnar
2006-06-21 17:38 ` Artur Skawina
2006-06-28 5:44 ` Paul Jackson
2006-06-28 8:53 ` Andi Kleen
2006-06-28 9:00 ` Ingo Molnar
2006-06-29 8:47 ` Paul Jackson
2006-06-21 9:26 ` Andi Kleen
2006-06-21 9:35 ` Ingo Molnar
2006-06-21 21:54 ` Rohit Seth
2006-06-21 22:21 ` Andi Kleen
2006-06-21 22:59 ` Rohit Seth
2006-06-21 23:05 ` Andi Kleen
2006-06-21 23:18 ` Rohit Seth
2006-06-21 23:29 ` Andi Kleen
2006-06-22 0:55 ` Rohit Seth
2006-06-22 8:08 ` Andi Kleen
2006-06-22 21:06 ` Rohit Seth
2006-06-22 22:14 ` Andi Kleen
2006-06-22 23:10 ` Rohit Seth
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=200606211950.47529.ak@suse.de \
--to=ak@suse.de \
--cc=76306.1226@compuserve.com \
--cc=drepper@redhat.com \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=torvalds@osdl.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