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


Groups > linux.kernel > #1360333

Re: [PATCH v8 3/6] cpufreq: powernv: Remove cpu_to_chip_id() from hot-path

From Michael Neuling <mikey@neuling.org>
Newsgroups linux.kernel
Subject Re: [PATCH v8 3/6] cpufreq: powernv: Remove cpu_to_chip_id() from hot-path
Date 2016-03-18 05:20 +0100
Message-ID <rdU3g-vw-7@gated-at.bofh.it> (permalink)
References <qXP7A-7Ux-7@gated-at.bofh.it> <qXP7B-7Ux-15@gated-at.bofh.it> <rdTTz-se-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 2016-03-18 at 15:04 +1100, Michael Neuling wrote:

> On Wed, 2016-02-03 at 01:11 +0530, Shilpasri G Bhat wrote:
> 

> > cpu_to_chip_id() does a DT walk through to find out the chip id by
> > taking a contended device tree lock. This adds an unnecessary
> > overhead
> > in a hot path. So instead of calling cpu_to_chip_id() everytime
> > cache
> > the chip ids for all cores in the array 'core_to_chip_map' and use
> > it
> > in the hotpath.
> > 
> > Reported-by: Anton Blanchard <anton@samba.org>
> > Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
> > Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> > Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> > No changes from v7.
> 
> How about this instead?  It removes the linear lookup and seems a lot
> less complex.

BTW we never init nr_chips before using it.  We also need something
like.

diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
index d63d2cb..c819ed4 100644
--- a/drivers/cpufreq/powernv-cpufreq.c
+++ b/drivers/cpufreq/powernv-cpufreq.c
@@ -556,6 +556,8 @@ static int init_chip_info(void)
 	unsigned int cpu, i;
 	unsigned int prev_chip_id = UINT_MAX;
 
+	nr_chips = 0;
+
 	for_each_possible_cpu(cpu) {
 		unsigned int id = cpu_to_chip_id(cpu);
 

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


Thread

Re: [PATCH v8 3/6] cpufreq: powernv: Remove cpu_to_chip_id() from  hot-path Michael Neuling <mikey@neuling.org> - 2016-03-18 05:10 +0100
  Re: [PATCH v8 3/6] cpufreq: powernv: Remove cpu_to_chip_id() from  hot-path Michael Neuling <mikey@neuling.org> - 2016-03-18 05:20 +0100
    Re: [PATCH v8 3/6] cpufreq: powernv: Remove cpu_to_chip_id() from hot-path "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-18 14:20 +0100
    [PATCH] cpufreq: powernv: Define per_cpu chip pointer to optimize hot-path Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2016-03-18 16:00 +0100
      Re: [PATCH] cpufreq: powernv: Define per_cpu chip pointer to  optimize hot-path Viresh Kumar <viresh.kumar@linaro.org> - 2016-03-21 08:30 +0100
        Re: [PATCH] cpufreq: powernv: Define per_cpu chip pointer to optimize hot-path "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-03-21 15:20 +0100
  Re: [PATCH v8 3/6] cpufreq: powernv: Remove cpu_to_chip_id() from  hot-path Benjamin Herrenschmidt <benh@au1.ibm.com> - 2016-03-18 23:40 +0100
    Re: [PATCH v8 3/6] cpufreq: powernv: Remove cpu_to_chip_id() from  hot-path Michael Neuling <mikey@neuling.org> - 2016-03-19 00:30 +0100

csiph-web