lkml.org 
[lkml]   [2016]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu lookups


On Wed, 17 Feb 2016, Thomas Gleixner wrote:

> On Wed, 17 Feb 2016, Vikas Shivappa wrote:
>
> Yes, please resend the rapl one. perf_uncore is a different trainwreck which I
> fixed already:
>
> lkml.kernel.org/r/20160217132903.767990400@linutronix.de

Ok , will resend the rapl separately.

the fix i sent however was a little different in that it uses a static
tmp_cpumask to avoid the loop in the cpumask_and_any below -
while ((n = cpumask_next(n, src1p)) < nr_cpu_ids)
if (cpumask_test_cpu(n, src2p))

But we have an extra static - static to avoid having it in the
stack..

copy below -

+/*
+ * Temporary cpumask used during hot cpu notificaiton handling. The usage
+ * is serialized by hot cpu locks.
+ */
+static cpumask_t tmp_cpumask;
+

static void rapl_cpu_init(int cpu)
{
- int i, phys_id = topology_physical_package_id(cpu);
-
- /* check if phys_is is already covered */
- for_each_cpu(i, &rapl_cpu_mask) {
- if (phys_id == topology_physical_package_id(i))
- return;
- }
- /* was not found, so add it */
- cpumask_set_cpu(cpu, &rapl_cpu_mask);
+ /* check if cpu's package is already covered.If not, add it.*/
+ cpumask_and(&tmp_cpumask, &rapl_cpu_mask, topology_core_cpumask(cpu));
+ if (cpumask_empty(&tmp_cpumask))
+ cpumask_set_cpu(cpu, &rapl_cpu_mask);
}

Thanks,
Vikas

>
> Thanks,
>
> tglx
>

\
 
 \ /
  Last update: 2016-02-17 20:21    [W:0.074 / U:1.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site