Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1336654

Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu lookups

From Vikas Shivappa <vikas.shivappa@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu lookups
Date 2016-02-17 19:50 +0100
Message-ID <r3fkL-1Vw-29@gated-at.bofh.it> (permalink)
References <r3cwx-8pl-7@gated-at.bofh.it> <r3cZz-oW-1@gated-at.bofh.it> <r3f1p-1O1-35@gated-at.bofh.it> <r3fb4-1S3-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



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
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Thomas Gleixner <tglx@linutronix.de> - 2016-02-17 16:50 +0100
  Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Thomas Gleixner <tglx@linutronix.de> - 2016-02-17 17:20 +0100
    Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-17 17:30 +0100
    Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Vikas Shivappa <vikas.shivappa@intel.com> - 2016-02-17 19:30 +0100
      Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Thomas Gleixner <tglx@linutronix.de> - 2016-02-17 19:40 +0100
      Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Thomas Gleixner <tglx@linutronix.de> - 2016-02-17 19:40 +0100
        Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Vikas Shivappa <vikas.shivappa@intel.com> - 2016-02-17 19:50 +0100
          Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Thomas Gleixner <tglx@linutronix.de> - 2016-02-17 20:20 +0100
            Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Thomas Gleixner <tglx@linutronix.de> - 2016-02-18 21:20 +0100
              Re: [PATCH] x86/perf/intel/cqm: Get rid of the silly for_each_cpu  lookups Vikas Shivappa <vikas.shivappa@intel.com> - 2016-02-19 00:20 +0100

csiph-web