From: Robert Richter <robert.richter@amd.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Stephane Eranian <eranian@google.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] perf, x86: Fix event scheduler to solve complex scheduling problems
Date: Mon, 18 Apr 2011 10:17:58 +0200 [thread overview]
Message-ID: <20110418081758.GO31407@erda.amd.com> (raw)
In-Reply-To: <20110417112325.GN31407@erda.amd.com>
[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]
On 17.04.11 13:23:25, Robert Richter wrote:
> $ perl counter-scheduling.pl | grep Num
> Number of counters: 2, loops: 10, redos: 4, ratio: 2.5
> Number of counters: 3, loops: 26, redos: 7, ratio: 3.7
> Number of counters: 4, loops: 53, redos: 11, ratio: 4.8
> Number of counters: 5, loops: 89, redos: 15, ratio: 5.9
> Number of counters: 6, loops: 134, redos: 19, ratio: 7.1
> Number of counters: 7, loops: 188, redos: 23, ratio: 8.2
> Number of counters: 8, loops: 251, redos: 27, ratio: 9.3
> Number of counters: 9, loops: 323, redos: 31, ratio: 10.4
> Number of counters: 10, loops: 404, redos: 35, ratio: 11.5
> Number of counters: 11, loops: 494, redos: 39, ratio: 12.7
> Number of counters: 12, loops: 593, redos: 43, ratio: 13.8
Wrong, wrong, wrong!
Before wasting your time with this, the script is buggy storing the
correct state:
@@ -35,7 +35,7 @@ while ($scheduled < $num_events) {
}
$used_mask |= (1 << $idx);
- push @sched_log, $idx;
+ $sched_log[$scheduled] = $idx;
printf "Scheduling event #%d on counter #%d\n", $scheduled, $idx;
$scheduled++;
}
It's not possible do the calculation for 11 counters in reasonable
time:
$ perl counter-scheduling.pl | grep Num
Number of counters: 2, loops: 10, redos: 4, ratio: 2.5
Number of counters: 3, loops: 48, redos: 15, ratio: 3.2
Number of counters: 4, loops: 260, redos: 64, ratio: 4.1
Number of counters: 5, loops: 1630, redos: 325, ratio: 5.0
Number of counters: 6, loops: 11742, redos: 1956, ratio: 6.0
Number of counters: 7, loops: 95900, redos: 13699, ratio: 7.0
Number of counters: 8, loops: 876808, redos: 109600, ratio: 8.0
Number of counters: 9, loops: 8877690, redos: 986409, ratio: 9.0
Number of counters: 10, loops: 98641010, redos: 9864100, ratio: 10.0
Updated script attached.
Sorry,
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
[-- Attachment #2: counter-scheduling.pl --]
[-- Type: text/x-perl, Size: 992 bytes --]
#! /usr/bin/perl
#$num_ctrs = 11;
for ($num_ctrs = 2; $num_ctrs <= 12; $num_ctrs++) {
$num_events = $num_ctrs + 1;
@sched_log = ();
$scheduled = 0;
$used_mask = 0;
$loops = 0;
$redos = 0;
$scheduled = 0;
while ($scheduled < $num_events) {
for ($idx = $sched_log[$scheduled] || 0; $idx < $num_ctrs; $idx++)
{
$loops++;
last if !((1 << $idx) & $used_mask);
}
if ($idx == $num_ctrs) {
printf "Failed to schedule event #%d\n", $scheduled;
last if (!$scheduled);
$sched_log[$scheduled] = 0;
$scheduled--;
$idx = $sched_log[$scheduled];
$sched_log[$scheduled]++;
$used_mask &= ~(1 << $idx);
printf "Rollback event #%d on counter #%d\n", $scheduled, $idx;
$redos++;
redo;
}
$used_mask |= (1 << $idx);
$sched_log[$scheduled] = $idx;
printf "Scheduling event #%d on counter #%d\n", $scheduled, $idx;
$scheduled++;
}
printf("Number of counters: %2d, loops: %3d, redos: %3d, ratio: %.1f\n",
$num_ctrs, $loops, $redos, $loops / $redos);
}
next prev parent reply other threads:[~2011-04-18 8:18 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-16 0:27 [PATCH 0/4] perf, x86: Fixes for v2.6.39 Robert Richter
2011-04-16 0:27 ` [PATCH 1/4] perf, x86: Fix pre-defined cache-misses event for AMD family 15h cpus Robert Richter
2011-04-19 12:03 ` [tip:perf/urgent] " tip-bot for Andre Przywara
2011-04-16 0:27 ` [PATCH 2/4] perf, x86: Fix AMD family 15h FPU event constraints Robert Richter
2011-04-19 12:04 ` [tip:perf/urgent] " tip-bot for Robert Richter
2011-04-16 0:27 ` [PATCH 3/4] perf, x86: Use ALTERNATIVE() to check for X86_FEATURE_PERFCTR_CORE Robert Richter
2011-04-18 20:00 ` Andi Kleen
2011-04-19 10:39 ` Robert Richter
2011-04-19 18:21 ` Andi Kleen
2011-04-19 12:04 ` [tip:perf/core] " tip-bot for Robert Richter
2011-04-16 0:27 ` [PATCH 4/4] perf, x86: Fix event scheduler to solve complex scheduling problems Robert Richter
2011-04-16 8:51 ` Peter Zijlstra
2011-04-16 9:43 ` Ingo Molnar
2011-04-16 10:08 ` Peter Zijlstra
2011-04-16 10:14 ` Ingo Molnar
2011-04-16 10:15 ` Peter Zijlstra
2011-04-16 14:26 ` Valdis.Kletnieks
2011-04-17 8:15 ` Robert Richter
2011-04-17 8:18 ` Ingo Molnar
2011-04-17 8:53 ` Peter Zijlstra
2011-04-17 11:23 ` Robert Richter
2011-04-18 8:17 ` Robert Richter [this message]
2011-04-16 15:52 ` Stephane Eranian
2011-04-17 8:44 ` Robert Richter
2011-04-17 9:05 ` Stephane Eranian
2011-04-19 10:26 ` [PATCH v2] perf, x86: Fix event scheduler for constraints with overlapping counters Robert Richter
2011-04-19 11:29 ` Ingo Molnar
2011-04-19 13:55 ` Robert Richter
2011-04-28 9:50 ` Robert Richter
2011-05-18 21:16 ` Peter Zijlstra
2011-05-18 21:20 ` Ingo Molnar
2011-05-18 21:36 ` Peter Zijlstra
2011-05-19 10:49 ` Robert Richter
2011-05-19 18:06 ` Ingo Molnar
2011-05-20 3:18 ` Robert Richter
2011-09-01 12:56 ` Peter Zijlstra
2011-09-01 14:12 ` Robert Richter
2011-09-01 16:37 ` Peter Zijlstra
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=20110418081758.GO31407@erda.amd.com \
--to=robert.richter@amd.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.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
Powered by JetHome