[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111122162700.GH15738@erda.amd.com>
Date: Tue, 22 Nov 2011 17:27:00 +0100
From: Robert Richter <robert.richter@....com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Stephane Eranian <eranian@...gle.com>, Ingo Molnar <mingo@...e.hu>,
Andi Kleen <andi@...stfloor.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 0/2] perf, x86: handle overlapping counters
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists