From d9003340b377e0bffc67a2d3ecca9fe4d1016f34 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 6 Nov 2007 11:33:52 -0800 Subject: [PATCH] cpu alloc: ACPI cstate handling conversion Signed-off-by: Christoph Lameter --- arch/x86/kernel/acpi/cstate.c | 10 ++++++---- arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 8 +++++--- drivers/acpi/processor_perflib.c | 5 +++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index 10b6717..b3c66c9 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c @@ -15,6 +15,7 @@ #include #include +#include /* * Initialize bm_flags based on the CPU cache properties @@ -87,7 +88,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, if (reg->bit_offset != NATIVE_CSTATE_BEYOND_HALT) return -1; - percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu); + percpu_entry = CPU_PTR(cpu_cstate_entry, cpu); percpu_entry->states[cx->index].eax = 0; percpu_entry->states[cx->index].ecx = 0; @@ -138,7 +139,7 @@ void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx) unsigned int cpu = smp_processor_id(); struct cstate_entry *percpu_entry; - percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu); + percpu_entry = CPU_PTR(cpu_cstate_entry, cpu); mwait_idle_with_hints(percpu_entry->states[cx->index].eax, percpu_entry->states[cx->index].ecx); } @@ -150,13 +151,14 @@ static int __init ffh_cstate_init(void) if (c->x86_vendor != X86_VENDOR_INTEL) return -1; - cpu_cstate_entry = alloc_percpu(struct cstate_entry); + cpu_cstate_entry = CPU_ALLOC(struct cstate_entry, + GFP_KERNEL|__GFP_ZERO); return 0; } static void __exit ffh_cstate_exit(void) { - free_percpu(cpu_cstate_entry); + CPU_FREE(cpu_cstate_entry); cpu_cstate_entry = NULL; } diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index fea0af0..2eed7c2 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -513,7 +514,8 @@ static int __init acpi_cpufreq_early_init(void) { dprintk("acpi_cpufreq_early_init\n"); - acpi_perf_data = alloc_percpu(struct acpi_processor_performance); + acpi_perf_data = CPU_ALLOC(struct acpi_processor_performance, + GFP_KERNEL|__GFP_ZERO); if (!acpi_perf_data) { dprintk("Memory allocation error for acpi_perf_data.\n"); return -ENOMEM; @@ -569,7 +571,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) if (!data) return -ENOMEM; - data->acpi_data = percpu_ptr(acpi_perf_data, cpu); + data->acpi_data = CPU_PTR(acpi_perf_data, cpu); drv_data[cpu] = data; if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) @@ -782,7 +784,7 @@ static void __exit acpi_cpufreq_exit(void) cpufreq_unregister_driver(&acpi_cpufreq_driver); - free_percpu(acpi_perf_data); + CPU_FREE(acpi_perf_data); return; } diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 463b024..3928720 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF #include @@ -567,12 +568,12 @@ int acpi_processor_preregister_performance( continue; } - if (!performance || !percpu_ptr(performance, i)) { + if (!performance || !CPU_PTR(performance, i)) { retval = -EINVAL; continue; } - pr->performance = percpu_ptr(performance, i); + pr->performance = CPU_PTR(performance, i); cpu_set(i, pr->performance->shared_cpu_map); if (acpi_processor_get_psd(pr)) { retval = -EINVAL; -- 1.5.3.4