From: Robert Richter <robert.richter@amd.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>,
Ingo Molnar <mingo@elte.hu>, Andi Kleen <andi@firstfloor.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 0/2] perf, x86: handle overlapping counters
Date: Tue, 22 Nov 2011 17:27:00 +0100 [thread overview]
Message-ID: <20111122162700.GH15738@erda.amd.com> (raw)
In-Reply-To: <1321975567.14799.15.camel@twins>
On 22.11.11 16:26:07, Peter Zijlstra wrote:
> @@ -574,16 +574,25 @@ static bool __perf_sched_find_counter(st
>
> c = sched->constraints[sched->state.event];
>
> + /* Prefer fixed purpose counters */
> + if (x86_pmu.num_counters_fixed) {
> + idx = X86_PMC_IDX_FIXED;
> + for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_MAX) {
> + if (!__test_and_set_bit(idx, sched->state.used))
> + goto done;
> + }
> + }
> /* Grab the first unused counter starting with idx */
> idx = sched->state.counter;
> - for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_MAX) {
> + for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_FIXED) {
> if (!__test_and_set_bit(idx, sched->state.used))
> - break;
> + goto done;
> }
> - sched->state.counter = idx;
>
> - if (idx >= X86_PMC_IDX_MAX)
> - return false;
> + return false;
> +
> +done:
> + sched->state.counter = idx;
Yes, we don't need to save this on failure. Looks ok.
-Robert
>
> if (c->overlap)
> perf_sched_save_state(sched);
>
>
--
Advanced Micro Devices, Inc.
Operating System Research Center
prev parent reply other threads:[~2011-11-22 16:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-18 11:35 [PATCH v4 0/2] perf, x86: handle overlapping counters Robert Richter
2011-11-18 11:35 ` [PATCH v4 1/2] perf, x86: Implement event scheduler helper functions Robert Richter
2011-12-06 9:44 ` [tip:perf/core] " tip-bot for Robert Richter
2011-11-18 11:35 ` [PATCH v4 2/2] perf, x86: Fix event scheduler for constraints with overlapping counters Robert Richter
2011-12-06 9:45 ` [tip:perf/core] " tip-bot for Robert Richter
2011-11-18 15:10 ` [PATCH v4 0/2] perf, x86: handle " Peter Zijlstra
2011-11-18 16:32 ` Robert Richter
2011-11-22 15:26 ` Peter Zijlstra
2011-11-22 16:27 ` Robert Richter [this message]
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=20111122162700.GH15738@erda.amd.com \
--to=robert.richter@amd.com \
--cc=andi@firstfloor.org \
--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