From: Mike Travis <travis@sgi.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
Andi Kleen <ak@suse.de>
Cc: Christoph Lameter <clameter@sgi.com>,
Jack Steiner <steiner@sgi.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Len Brown <len.brown@intel.com>,
linux-acpi@vger.kernel.org
Subject: [PATCH 2/4] acpi: change cpufreq tables to per_cpu variables
Date: Fri, 08 Feb 2008 15:37:40 -0800 [thread overview]
Message-ID: <20080208233738.427702000@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: <20080208233738.108449000@polaris-admin.engr.sgi.com>
[-- Attachment #1: nr_cpus-in-acpi-driver --]
[-- Type: text/plain, Size: 2763 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);
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-02-08 23:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-08 23:37 [PATCH 0/4] NR_CPUS: non-x86 arch specific reduction of NR_CPUS usage Mike Travis
2008-02-08 23:37 ` [PATCH 1/4] cpufreq: change cpu freq tables to per_cpu variables Mike Travis
2008-02-11 2:48 ` Dave Jones
2008-02-11 17:32 ` Mike Travis
2008-02-11 17:56 ` Dave Jones
2008-02-08 23:37 ` Mike Travis [this message]
2008-02-12 23:33 ` [PATCH 2/4] acpi: change cpufreq " Andrew Morton
2008-02-13 18:10 ` Mike Travis
2008-02-13 19:43 ` Andrew Morton
2008-02-08 23:37 ` [PATCH 3/4] oprofile: change cpu_buffer from array to per_cpu variable Mike Travis
2008-02-08 23:37 ` [PATCH 4/4] x86: minor cleanup of comments in processor.h Mike Travis
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=20080208233738.427702000@polaris-admin.engr.sgi.com \
--to=travis@sgi.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=clameter@sgi.com \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=steiner@sgi.com \
--cc=tglx@linutronix.de \
/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