diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-31 21:08:47 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-03 13:15:40 -0500 |
commit | 2fdf66b491ac706657946442789ec644cc317e1a (patch) | |
tree | 3442c3e1f7bceb870ab1ba2624e21767f8347508 /arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |
parent | ee943a82b697456f9d2ac46f1e6d230beedb4b6c (diff) |
cpumask: convert shared_cpu_map in acpi_processor* structs to cpumask_var_t
Impact: Reduce memory usage, use new API.
This is part of an effort to reduce structure sizes for machines
configured with large NR_CPUS. cpumask_t gets replaced by
cpumask_var_t, which is either struct cpumask[1] (small NR_CPUS) or
struct cpumask * (large NR_CPUS).
(Changes to powernow-k* by <travis>.)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 88ea02dcb622..d0a001093b2d 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -517,6 +517,17 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu) | |||
517 | } | 517 | } |
518 | } | 518 | } |
519 | 519 | ||
520 | static void free_acpi_perf_data(void) | ||
521 | { | ||
522 | unsigned int i; | ||
523 | |||
524 | /* Freeing a NULL pointer is OK, and alloc_percpu zeroes. */ | ||
525 | for_each_possible_cpu(i) | ||
526 | free_cpumask_var(per_cpu_ptr(acpi_perf_data, i) | ||
527 | ->shared_cpu_map); | ||
528 | free_percpu(acpi_perf_data); | ||
529 | } | ||
530 | |||
520 | /* | 531 | /* |
521 | * acpi_cpufreq_early_init - initialize ACPI P-States library | 532 | * acpi_cpufreq_early_init - initialize ACPI P-States library |
522 | * | 533 | * |
@@ -527,6 +538,7 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu) | |||
527 | */ | 538 | */ |
528 | static int __init acpi_cpufreq_early_init(void) | 539 | static int __init acpi_cpufreq_early_init(void) |
529 | { | 540 | { |
541 | unsigned int i; | ||
530 | dprintk("acpi_cpufreq_early_init\n"); | 542 | dprintk("acpi_cpufreq_early_init\n"); |
531 | 543 | ||
532 | acpi_perf_data = alloc_percpu(struct acpi_processor_performance); | 544 | acpi_perf_data = alloc_percpu(struct acpi_processor_performance); |
@@ -534,6 +546,15 @@ static int __init acpi_cpufreq_early_init(void) | |||
534 | dprintk("Memory allocation error for acpi_perf_data.\n"); | 546 | dprintk("Memory allocation error for acpi_perf_data.\n"); |
535 | return -ENOMEM; | 547 | return -ENOMEM; |
536 | } | 548 | } |
549 | for_each_possible_cpu(i) { | ||
550 | if (!alloc_cpumask_var(&per_cpu_ptr(acpi_perf_data, i) | ||
551 | ->shared_cpu_map, GFP_KERNEL)) { | ||
552 | |||
553 | /* Freeing a NULL pointer is OK: alloc_percpu zeroes. */ | ||
554 | free_acpi_perf_data(); | ||
555 | return -ENOMEM; | ||
556 | } | ||
557 | } | ||
537 | 558 | ||
538 | /* Do initialization in ACPI core */ | 559 | /* Do initialization in ACPI core */ |
539 | acpi_processor_preregister_performance(acpi_perf_data); | 560 | acpi_processor_preregister_performance(acpi_perf_data); |
@@ -604,9 +625,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
604 | */ | 625 | */ |
605 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || | 626 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || |
606 | policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { | 627 | policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { |
607 | policy->cpus = perf->shared_cpu_map; | 628 | cpumask_copy(&policy->cpus, perf->shared_cpu_map); |
608 | } | 629 | } |
609 | policy->related_cpus = perf->shared_cpu_map; | 630 | cpumask_copy(&policy->related_cpus, perf->shared_cpu_map); |
610 | 631 | ||
611 | #ifdef CONFIG_SMP | 632 | #ifdef CONFIG_SMP |
612 | dmi_check_system(sw_any_bug_dmi_table); | 633 | dmi_check_system(sw_any_bug_dmi_table); |
@@ -795,7 +816,7 @@ static int __init acpi_cpufreq_init(void) | |||
795 | 816 | ||
796 | ret = cpufreq_register_driver(&acpi_cpufreq_driver); | 817 | ret = cpufreq_register_driver(&acpi_cpufreq_driver); |
797 | if (ret) | 818 | if (ret) |
798 | free_percpu(acpi_perf_data); | 819 | free_acpi_perf_data(); |
799 | 820 | ||
800 | return ret; | 821 | return ret; |
801 | } | 822 | } |