public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	Linux PM <linux-pm@vger.kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH v4 2/2] powercap/rapl: reduce ipi calls
Date: Fri, 19 Feb 2016 23:01:59 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1602192301250.2477@nanos> (raw)
In-Reply-To: <alpine.DEB.2.11.1602192246070.2477@nanos>



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
> 

  reply	other threads:[~2016-02-19 22:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19 20:37 [PATCH v4 0/2] powercap/rapl: reduce ipi calls and misc clean up Jacob Pan
2016-02-19 20:37 ` [PATCH v4 1/2] cpumask: export cpumask_any_but Jacob Pan
2016-02-19 20:37 ` [PATCH v4 2/2] powercap/rapl: reduce ipi calls Jacob Pan
2016-02-19 21:50   ` Thomas Gleixner
2016-02-19 22:01     ` Thomas Gleixner [this message]
2016-02-19 22:23       ` Jacob Pan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.11.1602192301250.2477@nanos \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rusty@rustcorp.com.au \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox