[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120608203828.GA5220@aftab.osrc.amd.com>
Date: Fri, 8 Jun 2012 22:38:28 +0200
From: Borislav Petkov <borislav.petkov@....com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Ingo Molnar <mingo@...nel.org>,
Stephane Eranian <eranian@...gle.com>,
<linux-kernel@...r.kernel.org>, <andi@...stfloor.org>,
<mingo@...e.hu>, <ming.m.lin@...el.com>,
Andreas Herrmann <andreas.herrmann3@....com>,
Dimitri Sivanich <sivanich@....com>,
Dmitry Adamushko <dmitry.adamushko@...il.com>
Subject: Re: [PATCH] perf/x86: check ucode before disabling PEBS on
SandyBridge
On Fri, Jun 08, 2012 at 08:52:17PM +0200, Peter Zijlstra wrote:
> Checking a bitmap of n bits for being all zero is O(n), so the total is
> still O(n^2). Still, probably faster than the for_each_online_cpu() scan
> I do now.
Ok, here's what I mean:
On init you do:
cpumask_copy(ucode_mask, cpu_online_mask);
In the notifier:
cpumask_clear_cpu(this_cpu, ucode_mask);
if (cpumask_empty(ucode_mask))
verify_pebs();
So, on each cpu you do cpumask_clear_cpu() which should be O(k) for some
constant k.
And ok, cpumask_empty() aka __bitmap_empty() iterates over
nbits/BITS_PER_LONG, so here's the O(n), I see what you mean.
Well, you could probably replace cpumask_empty() with cpumask_weight()
which should use POPCNT in newer hardware and should be almost for free.
--
Regards/Gruss,
Boris.
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551
--
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