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


Groups > linux.kernel > #1338514

Re: [PATCH v4 2/2] powercap/rapl: reduce ipi calls

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH v4 2/2] powercap/rapl: reduce ipi calls
Date 2016-02-19 23:10 +0100
Message-ID <r41pn-3DD-5@gated-at.bofh.it> (permalink)
References <r400h-2qQ-9@gated-at.bofh.it> <r400i-2qQ-13@gated-at.bofh.it> <r41fK-3j1-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Fri, 19 Feb 2016, Thomas Gleixner wrote:

> On Fri, 19 Feb 2016, Jacob Pan wrote:
> > @@ -1380,6 +1375,7 @@ static int rapl_detect_topology(void)
> >  	int i;
> >  	int phy_package_id;
> >  	struct rapl_package *new_package, *rp;
> > +	int lead_cpu;
> >  
> >  	for_each_online_cpu(i) {
> >  		phy_package_id = topology_physical_package_id(i);
> > @@ -1392,7 +1388,11 @@ static int rapl_detect_topology(void)
> >  			/* add the new package to the list */
> >  			new_package->id = phy_package_id;
> >  			new_package->nr_cpus = 1;
> > -
> > +			/* find the first active cpu of the package */
> > +			lead_cpu = cpumask_any_and(topology_core_cpumask(i),
> > +						cpumask_of(i));
> 
> Yuck. Why any_and? The result is i, simply because i is online otherwise you
> would not be there. 
> 
> > +			if (lead_cpu < nr_cpu_ids)
> > +				new_package->lead_cpu = lead_cpu;
> 
> So the above is identical to 
> 
> 			new_package->lead_cpu = lead_cpu;

			new_package->lead_cpu = i;

Copy and paste sucks :)

> Hmm?
> 
> > @@ -1500,6 +1503,15 @@ static int rapl_cpu_callback(struct notifier_block *nfb,
> >  			break;
> >  		if (--rp->nr_cpus == 0)
> >  			rapl_remove_package(rp);
> > +		else if (cpu == rp->lead_cpu) {
> > +			/* choose another active cpu in the package */
> > +			lead_cpu = cpumask_any_but(topology_core_cpumask(cpu), cpu);
> 
> This part is correct.
> 
> Thanks,
> 
> 	tglx
> 

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


Thread

[PATCH v4 0/2] powercap/rapl: reduce ipi calls and misc clean up Jacob Pan <jacob.jun.pan@linux.intel.com> - 2016-02-19 21:40 +0100
  [PATCH v4 2/2] powercap/rapl: reduce ipi calls Jacob Pan <jacob.jun.pan@linux.intel.com> - 2016-02-19 21:40 +0100
    Re: [PATCH v4 2/2] powercap/rapl: reduce ipi calls Thomas Gleixner <tglx@linutronix.de> - 2016-02-19 23:00 +0100
      Re: [PATCH v4 2/2] powercap/rapl: reduce ipi calls Thomas Gleixner <tglx@linutronix.de> - 2016-02-19 23:10 +0100
        Re: [PATCH v4 2/2] powercap/rapl: reduce ipi calls Jacob Pan <jacob.jun.pan@linux.intel.com> - 2016-02-19 23:30 +0100
  [PATCH v4 1/2] cpumask: export cpumask_any_but Jacob Pan <jacob.jun.pan@linux.intel.com> - 2016-02-19 21:40 +0100

csiph-web