aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/cpufreq
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2007-10-16 04:24:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:42:50 -0400
commit083576112940fda783d716fd5ccc744f81667b2f (patch)
tree226139e7cb9863c91d1e2a1ac0babb0db94f3d11 /arch/x86/kernel/cpu/cpufreq
parentcc84634f29d5a92932400a2d52ca17dee2c8a462 (diff)
x86: Convert cpu_core_map to be a per cpu variable
This is from an earlier message from 'Christoph Lameter': cpu_core_map is currently an array defined using NR_CPUS. This means that we overallocate since we will rarely really use maximum configured cpu. If we put the cpu_core_map into the per cpu area then it will be allocated for each processor as it comes online. This means that the core map cannot be accessed until the per cpu area has been allocated. Xen does a weird thing here looping over all processors and zeroing the masks that are not yet allocated and that will be zeroed when they are allocated. I commented the code out. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Mike Travis <travis@sgi.com> Cc: Andi Kleen <ak@suse.de> Cc: Christoph Lameter <clameter@sgi.com> Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/kernel/cpu/cpufreq')
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index ffd01e5dcb52..2ca43ba32bc0 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -595,7 +595,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
595 dmi_check_system(sw_any_bug_dmi_table); 595 dmi_check_system(sw_any_bug_dmi_table);
596 if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) { 596 if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) {
597 policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; 597 policy->shared_type = CPUFREQ_SHARED_TYPE_ALL;
598 policy->cpus = cpu_core_map[cpu]; 598 policy->cpus = per_cpu(cpu_core_map, cpu);
599 } 599 }
600#endif 600#endif
601 601
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index b273b69cfddf..c06ac680c9ca 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -57,7 +57,7 @@ static struct powernow_k8_data *powernow_data[NR_CPUS];
57static int cpu_family = CPU_OPTERON; 57static int cpu_family = CPU_OPTERON;
58 58
59#ifndef CONFIG_SMP 59#ifndef CONFIG_SMP
60static cpumask_t cpu_core_map[1]; 60DEFINE_PER_CPU(cpumask_t, cpu_core_map);
61#endif 61#endif
62 62
63/* Return a frequency in MHz, given an input fid */ 63/* Return a frequency in MHz, given an input fid */
@@ -667,7 +667,7 @@ static int fill_powernow_table(struct powernow_k8_data *data, struct pst_s *pst,
667 667
668 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid); 668 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid);
669 data->powernow_table = powernow_table; 669 data->powernow_table = powernow_table;
670 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu) 670 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu)
671 print_basics(data); 671 print_basics(data);
672 672
673 for (j = 0; j < data->numps; j++) 673 for (j = 0; j < data->numps; j++)
@@ -821,7 +821,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
821 821
822 /* fill in data */ 822 /* fill in data */
823 data->numps = data->acpi_data.state_count; 823 data->numps = data->acpi_data.state_count;
824 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu) 824 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu)
825 print_basics(data); 825 print_basics(data);
826 powernow_k8_acpi_pst_values(data, 0); 826 powernow_k8_acpi_pst_values(data, 0);
827 827
@@ -1214,7 +1214,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1214 if (cpu_family == CPU_HW_PSTATE) 1214 if (cpu_family == CPU_HW_PSTATE)
1215 pol->cpus = cpumask_of_cpu(pol->cpu); 1215 pol->cpus = cpumask_of_cpu(pol->cpu);
1216 else 1216 else
1217 pol->cpus = cpu_core_map[pol->cpu]; 1217 pol->cpus = per_cpu(cpu_core_map, pol->cpu);
1218 data->available_cores = &(pol->cpus); 1218 data->available_cores = &(pol->cpus);
1219 1219
1220 /* Take a crude guess here. 1220 /* Take a crude guess here.
@@ -1281,7 +1281,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
1281 cpumask_t oldmask = current->cpus_allowed; 1281 cpumask_t oldmask = current->cpus_allowed;
1282 unsigned int khz = 0; 1282 unsigned int khz = 0;
1283 1283
1284 data = powernow_data[first_cpu(cpu_core_map[cpu])]; 1284 data = powernow_data[first_cpu(per_cpu(cpu_core_map, cpu))];
1285 1285
1286 if (!data) 1286 if (!data)
1287 return -EINVAL; 1287 return -EINVAL;