aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_perflib.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-12-31 21:08:47 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-03 13:15:40 -0500
commit2fdf66b491ac706657946442789ec644cc317e1a (patch)
tree3442c3e1f7bceb870ab1ba2624e21767f8347508 /drivers/acpi/processor_perflib.c
parentee943a82b697456f9d2ac46f1e6d230beedb4b6c (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 'drivers/acpi/processor_perflib.c')
-rw-r--r--drivers/acpi/processor_perflib.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 0d7b772bef50..846e227592d4 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -588,12 +588,15 @@ int acpi_processor_preregister_performance(
588 int count, count_target; 588 int count, count_target;
589 int retval = 0; 589 int retval = 0;
590 unsigned int i, j; 590 unsigned int i, j;
591 cpumask_t covered_cpus; 591 cpumask_var_t covered_cpus;
592 struct acpi_processor *pr; 592 struct acpi_processor *pr;
593 struct acpi_psd_package *pdomain; 593 struct acpi_psd_package *pdomain;
594 struct acpi_processor *match_pr; 594 struct acpi_processor *match_pr;
595 struct acpi_psd_package *match_pdomain; 595 struct acpi_psd_package *match_pdomain;
596 596
597 if (!alloc_cpumask_var(&covered_cpus, GFP_KERNEL))
598 return -ENOMEM;
599
597 mutex_lock(&performance_mutex); 600 mutex_lock(&performance_mutex);
598 601
599 retval = 0; 602 retval = 0;
@@ -617,7 +620,7 @@ int acpi_processor_preregister_performance(
617 } 620 }
618 621
619 pr->performance = percpu_ptr(performance, i); 622 pr->performance = percpu_ptr(performance, i);
620 cpu_set(i, pr->performance->shared_cpu_map); 623 cpumask_set_cpu(i, pr->performance->shared_cpu_map);
621 if (acpi_processor_get_psd(pr)) { 624 if (acpi_processor_get_psd(pr)) {
622 retval = -EINVAL; 625 retval = -EINVAL;
623 continue; 626 continue;
@@ -650,18 +653,18 @@ int acpi_processor_preregister_performance(
650 } 653 }
651 } 654 }
652 655
653 cpus_clear(covered_cpus); 656 cpumask_clear(covered_cpus);
654 for_each_possible_cpu(i) { 657 for_each_possible_cpu(i) {
655 pr = per_cpu(processors, i); 658 pr = per_cpu(processors, i);
656 if (!pr) 659 if (!pr)
657 continue; 660 continue;
658 661
659 if (cpu_isset(i, covered_cpus)) 662 if (cpumask_test_cpu(i, covered_cpus))
660 continue; 663 continue;
661 664
662 pdomain = &(pr->performance->domain_info); 665 pdomain = &(pr->performance->domain_info);
663 cpu_set(i, pr->performance->shared_cpu_map); 666 cpumask_set_cpu(i, pr->performance->shared_cpu_map);
664 cpu_set(i, covered_cpus); 667 cpumask_set_cpu(i, covered_cpus);
665 if (pdomain->num_processors <= 1) 668 if (pdomain->num_processors <= 1)
666 continue; 669 continue;
667 670
@@ -699,8 +702,8 @@ int acpi_processor_preregister_performance(
699 goto err_ret; 702 goto err_ret;
700 } 703 }
701 704
702 cpu_set(j, covered_cpus); 705 cpumask_set_cpu(j, covered_cpus);
703 cpu_set(j, pr->performance->shared_cpu_map); 706 cpumask_set_cpu(j, pr->performance->shared_cpu_map);
704 count++; 707 count++;
705 } 708 }
706 709
@@ -718,8 +721,8 @@ int acpi_processor_preregister_performance(
718 721
719 match_pr->performance->shared_type = 722 match_pr->performance->shared_type =
720 pr->performance->shared_type; 723 pr->performance->shared_type;
721 match_pr->performance->shared_cpu_map = 724 cpumask_copy(match_pr->performance->shared_cpu_map,
722 pr->performance->shared_cpu_map; 725 pr->performance->shared_cpu_map);
723 } 726 }
724 } 727 }
725 728
@@ -731,14 +734,15 @@ err_ret:
731 734
732 /* Assume no coordination on any error parsing domain info */ 735 /* Assume no coordination on any error parsing domain info */
733 if (retval) { 736 if (retval) {
734 cpus_clear(pr->performance->shared_cpu_map); 737 cpumask_clear(pr->performance->shared_cpu_map);
735 cpu_set(i, pr->performance->shared_cpu_map); 738 cpumask_set_cpu(i, pr->performance->shared_cpu_map);
736 pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; 739 pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL;
737 } 740 }
738 pr->performance = NULL; /* Will be set for real in register */ 741 pr->performance = NULL; /* Will be set for real in register */
739 } 742 }
740 743
741 mutex_unlock(&performance_mutex); 744 mutex_unlock(&performance_mutex);
745 free_cpumask_var(covered_cpus);
742 return retval; 746 return retval;
743} 747}
744EXPORT_SYMBOL(acpi_processor_preregister_performance); 748EXPORT_SYMBOL(acpi_processor_preregister_performance);