public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] acpi: change cpufreq tables to per_cpu variables
       [not found] <20080208233738.108449000@polaris-admin.engr.sgi.com>
@ 2008-02-08 23:37 ` Mike Travis
  2008-02-12 23:33   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Travis @ 2008-02-08 23:37 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar, Thomas Gleixner, Andi Kleen
  Cc: Christoph Lameter, Jack Steiner, linux-mm, linux-kernel,
	Len Brown, linux-acpi

[-- Attachment #1: nr_cpus-in-acpi-driver --]
[-- Type: text/plain, Size: 2537 bytes --]

Change cpufreq tables from arrays to per_cpu variables in
drivers/acpi/processor_thermal.c

Based on linux-2.6.git + x86.git

Cc: Len Brown <len.brown@intel.com>
Cc: linux-acpi@vger.kernel.org
Signed-off-by: Mike Travis <travis@sgi.com>
---
 drivers/acpi/processor_thermal.c |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

--- a/drivers/acpi/processor_thermal.c
+++ b/drivers/acpi/processor_thermal.c
@@ -93,7 +93,7 @@ static int acpi_processor_apply_limit(st
  * _any_ cpufreq driver and not only the acpi-cpufreq driver.
  */
 
-static unsigned int cpufreq_thermal_reduction_pctg[NR_CPUS];
+static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg);
 static unsigned int acpi_thermal_cpufreq_is_init = 0;
 
 static int cpu_has_cpufreq(unsigned int cpu)
@@ -109,8 +109,8 @@ static int acpi_thermal_cpufreq_increase
 	if (!cpu_has_cpufreq(cpu))
 		return -ENODEV;
 
-	if (cpufreq_thermal_reduction_pctg[cpu] < 60) {
-		cpufreq_thermal_reduction_pctg[cpu] += 20;
+	if (per_cpu(cpufreq_thermal_reduction_pctg, cpu) < 60) {
+		per_cpu(cpufreq_thermal_reduction_pctg, cpu) += 20;
 		cpufreq_update_policy(cpu);
 		return 0;
 	}
@@ -123,13 +123,13 @@ static int acpi_thermal_cpufreq_decrease
 	if (!cpu_has_cpufreq(cpu))
 		return -ENODEV;
 
-	if (cpufreq_thermal_reduction_pctg[cpu] > 20)
-		cpufreq_thermal_reduction_pctg[cpu] -= 20;
+	if (per_cpu(cpufreq_thermal_reduction_pctg, cpu) > 20)
+		per_cpu(cpufreq_thermal_reduction_pctg, cpu) -= 20;
 	else
-		cpufreq_thermal_reduction_pctg[cpu] = 0;
+		per_cpu(cpufreq_thermal_reduction_pctg, cpu) = 0;
 	cpufreq_update_policy(cpu);
 	/* We reached max freq again and can leave passive mode */
-	return !cpufreq_thermal_reduction_pctg[cpu];
+	return !per_cpu(cpufreq_thermal_reduction_pctg, cpu);
 }
 
 static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb,
@@ -143,7 +143,7 @@ static int acpi_thermal_cpufreq_notifier
 
 	max_freq =
 	    (policy->cpuinfo.max_freq *
-	     (100 - cpufreq_thermal_reduction_pctg[policy->cpu])) / 100;
+	     (100 - per_cpu(cpufreq_thermal_reduction_pctg, policy->cpu))) / 100;
 
 	cpufreq_verify_within_limits(policy, 0, max_freq);
 
@@ -159,8 +159,9 @@ void acpi_thermal_cpufreq_init(void)
 {
 	int i;
 
-	for (i = 0; i < NR_CPUS; i++)
-		cpufreq_thermal_reduction_pctg[i] = 0;
+	for (i = 0; i < nr_cpu_ids; i++)
+		if (cpu_present(i))
+			per_cpu(cpufreq_thermal_reduction_pctg, i) = 0;
 
 	i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block,
 				      CPUFREQ_POLICY_NOTIFIER);

-- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/4] acpi: change cpufreq tables to per_cpu variables
  2008-02-08 23:37 ` [PATCH 2/4] acpi: change cpufreq tables to per_cpu variables Mike Travis
@ 2008-02-12 23:33   ` Andrew Morton
  2008-02-13 18:10     ` Mike Travis
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2008-02-12 23:33 UTC (permalink / raw)
  To: Mike Travis
  Cc: mingo, tglx, ak, clameter, steiner, linux-mm, linux-kernel,
	len.brown, linux-acpi

On Fri, 08 Feb 2008 15:37:40 -0800
Mike Travis <travis@sgi.com> wrote:

> Change cpufreq tables from arrays to per_cpu variables in
> drivers/acpi/processor_thermal.c
> 
> Based on linux-2.6.git + x86.git

I fixed a bunch of rejects in "[PATCH 1/4] cpufreq: change cpu freq tables
to per_cpu variables" and it compiles OK.  But this one was beyond my
should-i-repair-it threshold, sorry.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/4] acpi: change cpufreq tables to per_cpu variables
  2008-02-12 23:33   ` Andrew Morton
@ 2008-02-13 18:10     ` Mike Travis
  2008-02-13 19:43       ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Travis @ 2008-02-13 18:10 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mingo, tglx, ak, clameter, steiner, linux-mm, linux-kernel,
	len.brown, linux-acpi

Andrew Morton wrote:
> On Fri, 08 Feb 2008 15:37:40 -0800
> Mike Travis <travis@sgi.com> wrote:
> 
>> Change cpufreq tables from arrays to per_cpu variables in
>> drivers/acpi/processor_thermal.c
>>
>> Based on linux-2.6.git + x86.git
> 
> I fixed a bunch of rejects in "[PATCH 1/4] cpufreq: change cpu freq tables
> to per_cpu variables" and it compiles OK.  But this one was beyond my
> should-i-repair-it threshold, sorry.

Should I rebase all the pending patches on 2.6.25-rc1 or 2.6.24-mm1
(or some other combination)?

Thanks,
Mike

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/4] acpi: change cpufreq tables to per_cpu variables
  2008-02-13 18:10     ` Mike Travis
@ 2008-02-13 19:43       ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2008-02-13 19:43 UTC (permalink / raw)
  To: Mike Travis
  Cc: mingo, tglx, ak, clameter, steiner, linux-mm, linux-kernel,
	len.brown, linux-acpi

On Wed, 13 Feb 2008 10:10:00 -0800
Mike Travis <travis@sgi.com> wrote:

> Andrew Morton wrote:
> > On Fri, 08 Feb 2008 15:37:40 -0800
> > Mike Travis <travis@sgi.com> wrote:
> > 
> >> Change cpufreq tables from arrays to per_cpu variables in
> >> drivers/acpi/processor_thermal.c
> >>
> >> Based on linux-2.6.git + x86.git
> > 
> > I fixed a bunch of rejects in "[PATCH 1/4] cpufreq: change cpu freq tables
> > to per_cpu variables" and it compiles OK.  But this one was beyond my
> > should-i-repair-it threshold, sorry.
> 
> Should I rebase all the pending patches on 2.6.25-rc1 or 2.6.24-mm1
> (or some other combination)?
> 

That depends on whether you have other things queued in one of the git
trees.  If not, against current mainline (which is later than 2.6.25-rc1!)
would suit.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-13 19:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20080208233738.108449000@polaris-admin.engr.sgi.com>
2008-02-08 23:37 ` [PATCH 2/4] acpi: change cpufreq tables to per_cpu variables Mike Travis
2008-02-12 23:33   ` Andrew Morton
2008-02-13 18:10     ` Mike Travis
2008-02-13 19:43       ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox