diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-01-04 08:18:06 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-06 03:05:31 -0500 |
commit | 835481d9bcd65720b473db6b38746a74a3964218 (patch) | |
tree | a6f0fa205542cf73a980a2f8e41d5e908a33b6d6 /arch | |
parent | 5cb0535f1713b51610f2881b17d0fe3656114364 (diff) |
cpumask: convert struct cpufreq_policy to cpumask_var_t
Impact: use new cpumask API to reduce memory usage
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).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Dave Jones <davej@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 10 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/p4-clockmod.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/powernow-k8.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c | 14 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/speedstep-ich.c | 18 |
6 files changed, 29 insertions, 29 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 28102ad1a363..0b31939862d6 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -411,7 +411,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, | |||
411 | 411 | ||
412 | #ifdef CONFIG_HOTPLUG_CPU | 412 | #ifdef CONFIG_HOTPLUG_CPU |
413 | /* cpufreq holds the hotplug lock, so we are safe from here on */ | 413 | /* cpufreq holds the hotplug lock, so we are safe from here on */ |
414 | cpus_and(online_policy_cpus, cpu_online_map, policy->cpus); | 414 | cpumask_and(&online_policy_cpus, cpu_online_mask, policy->cpus); |
415 | #else | 415 | #else |
416 | online_policy_cpus = policy->cpus; | 416 | online_policy_cpus = policy->cpus; |
417 | #endif | 417 | #endif |
@@ -626,15 +626,15 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
626 | */ | 626 | */ |
627 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || | 627 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || |
628 | policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { | 628 | policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { |
629 | cpumask_copy(&policy->cpus, perf->shared_cpu_map); | 629 | cpumask_copy(policy->cpus, perf->shared_cpu_map); |
630 | } | 630 | } |
631 | cpumask_copy(&policy->related_cpus, perf->shared_cpu_map); | 631 | cpumask_copy(policy->related_cpus, perf->shared_cpu_map); |
632 | 632 | ||
633 | #ifdef CONFIG_SMP | 633 | #ifdef CONFIG_SMP |
634 | dmi_check_system(sw_any_bug_dmi_table); | 634 | dmi_check_system(sw_any_bug_dmi_table); |
635 | if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) { | 635 | if (bios_with_sw_any_bug && cpumask_weight(policy->cpus) == 1) { |
636 | policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; | 636 | policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; |
637 | policy->cpus = per_cpu(cpu_core_map, cpu); | 637 | cpumask_copy(policy->cpus, cpu_core_mask(cpu)); |
638 | } | 638 | } |
639 | #endif | 639 | #endif |
640 | 640 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c index beea4466b063..b585e04cbc9e 100644 --- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c +++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c | |||
@@ -122,7 +122,7 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy, | |||
122 | return 0; | 122 | return 0; |
123 | 123 | ||
124 | /* notifiers */ | 124 | /* notifiers */ |
125 | for_each_cpu_mask_nr(i, policy->cpus) { | 125 | for_each_cpu(i, policy->cpus) { |
126 | freqs.cpu = i; | 126 | freqs.cpu = i; |
127 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 127 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
128 | } | 128 | } |
@@ -130,11 +130,11 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy, | |||
130 | /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software | 130 | /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software |
131 | * Developer's Manual, Volume 3 | 131 | * Developer's Manual, Volume 3 |
132 | */ | 132 | */ |
133 | for_each_cpu_mask_nr(i, policy->cpus) | 133 | for_each_cpu(i, policy->cpus) |
134 | cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); | 134 | cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); |
135 | 135 | ||
136 | /* notifiers */ | 136 | /* notifiers */ |
137 | for_each_cpu_mask_nr(i, policy->cpus) { | 137 | for_each_cpu(i, policy->cpus) { |
138 | freqs.cpu = i; | 138 | freqs.cpu = i; |
139 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 139 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
140 | } | 140 | } |
@@ -203,7 +203,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) | |||
203 | unsigned int i; | 203 | unsigned int i; |
204 | 204 | ||
205 | #ifdef CONFIG_SMP | 205 | #ifdef CONFIG_SMP |
206 | policy->cpus = per_cpu(cpu_sibling_map, policy->cpu); | 206 | cpumask_copy(policy->cpus, &per_cpu(cpu_sibling_map, policy->cpu)); |
207 | #endif | 207 | #endif |
208 | 208 | ||
209 | /* Errata workaround */ | 209 | /* Errata workaround */ |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index c3c9adbaa26f..5c28b37dea11 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -1199,10 +1199,10 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1199 | set_cpus_allowed_ptr(current, &oldmask); | 1199 | set_cpus_allowed_ptr(current, &oldmask); |
1200 | 1200 | ||
1201 | if (cpu_family == CPU_HW_PSTATE) | 1201 | if (cpu_family == CPU_HW_PSTATE) |
1202 | pol->cpus = cpumask_of_cpu(pol->cpu); | 1202 | cpumask_copy(pol->cpus, cpumask_of(pol->cpu)); |
1203 | else | 1203 | else |
1204 | pol->cpus = per_cpu(cpu_core_map, pol->cpu); | 1204 | cpumask_copy(pol->cpus, &per_cpu(cpu_core_map, pol->cpu)); |
1205 | data->available_cores = &(pol->cpus); | 1205 | data->available_cores = pol->cpus; |
1206 | 1206 | ||
1207 | /* Take a crude guess here. | 1207 | /* Take a crude guess here. |
1208 | * That guess was in microseconds, so multiply with 1000 */ | 1208 | * That guess was in microseconds, so multiply with 1000 */ |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h index 65cfb5d7f77f..8ecc75b6c7c3 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h | |||
@@ -53,7 +53,7 @@ struct powernow_k8_data { | |||
53 | /* we need to keep track of associated cores, but let cpufreq | 53 | /* we need to keep track of associated cores, but let cpufreq |
54 | * handle hotplug events - so just point at cpufreq pol->cpus | 54 | * handle hotplug events - so just point at cpufreq pol->cpus |
55 | * structure */ | 55 | * structure */ |
56 | cpumask_t *available_cores; | 56 | struct cpumask *available_cores; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | 59 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c index d2cc4991cbaa..f08998278a3a 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c | |||
@@ -492,8 +492,8 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
492 | } | 492 | } |
493 | 493 | ||
494 | first_cpu = 1; | 494 | first_cpu = 1; |
495 | for_each_cpu_mask_nr(j, policy->cpus) { | 495 | for_each_cpu(j, policy->cpus) { |
496 | const cpumask_t *mask; | 496 | const struct cpumask *mask; |
497 | 497 | ||
498 | /* cpufreq holds the hotplug lock, so we are safe here */ | 498 | /* cpufreq holds the hotplug lock, so we are safe here */ |
499 | if (!cpu_online(j)) | 499 | if (!cpu_online(j)) |
@@ -504,9 +504,9 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
504 | * Make sure we are running on CPU that wants to change freq | 504 | * Make sure we are running on CPU that wants to change freq |
505 | */ | 505 | */ |
506 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) | 506 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) |
507 | mask = &policy->cpus; | 507 | mask = policy->cpus; |
508 | else | 508 | else |
509 | mask = &cpumask_of_cpu(j); | 509 | mask = cpumask_of(j); |
510 | 510 | ||
511 | set_cpus_allowed_ptr(current, mask); | 511 | set_cpus_allowed_ptr(current, mask); |
512 | preempt_disable(); | 512 | preempt_disable(); |
@@ -538,7 +538,7 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
538 | dprintk("target=%dkHz old=%d new=%d msr=%04x\n", | 538 | dprintk("target=%dkHz old=%d new=%d msr=%04x\n", |
539 | target_freq, freqs.old, freqs.new, msr); | 539 | target_freq, freqs.old, freqs.new, msr); |
540 | 540 | ||
541 | for_each_cpu_mask_nr(k, policy->cpus) { | 541 | for_each_cpu(k, policy->cpus) { |
542 | if (!cpu_online(k)) | 542 | if (!cpu_online(k)) |
543 | continue; | 543 | continue; |
544 | freqs.cpu = k; | 544 | freqs.cpu = k; |
@@ -563,7 +563,7 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
563 | preempt_enable(); | 563 | preempt_enable(); |
564 | } | 564 | } |
565 | 565 | ||
566 | for_each_cpu_mask_nr(k, policy->cpus) { | 566 | for_each_cpu(k, policy->cpus) { |
567 | if (!cpu_online(k)) | 567 | if (!cpu_online(k)) |
568 | continue; | 568 | continue; |
569 | freqs.cpu = k; | 569 | freqs.cpu = k; |
@@ -586,7 +586,7 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
586 | tmp = freqs.new; | 586 | tmp = freqs.new; |
587 | freqs.new = freqs.old; | 587 | freqs.new = freqs.old; |
588 | freqs.old = tmp; | 588 | freqs.old = tmp; |
589 | for_each_cpu_mask_nr(j, policy->cpus) { | 589 | for_each_cpu(j, policy->cpus) { |
590 | if (!cpu_online(j)) | 590 | if (!cpu_online(j)) |
591 | continue; | 591 | continue; |
592 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 592 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c index 04d0376b64b0..dedc1e98f168 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c | |||
@@ -229,7 +229,7 @@ static unsigned int speedstep_detect_chipset (void) | |||
229 | return 0; | 229 | return 0; |
230 | } | 230 | } |
231 | 231 | ||
232 | static unsigned int _speedstep_get(const cpumask_t *cpus) | 232 | static unsigned int _speedstep_get(const struct cpumask *cpus) |
233 | { | 233 | { |
234 | unsigned int speed; | 234 | unsigned int speed; |
235 | cpumask_t cpus_allowed; | 235 | cpumask_t cpus_allowed; |
@@ -244,7 +244,7 @@ static unsigned int _speedstep_get(const cpumask_t *cpus) | |||
244 | 244 | ||
245 | static unsigned int speedstep_get(unsigned int cpu) | 245 | static unsigned int speedstep_get(unsigned int cpu) |
246 | { | 246 | { |
247 | return _speedstep_get(&cpumask_of_cpu(cpu)); | 247 | return _speedstep_get(cpumask_of(cpu)); |
248 | } | 248 | } |
249 | 249 | ||
250 | /** | 250 | /** |
@@ -267,7 +267,7 @@ static int speedstep_target (struct cpufreq_policy *policy, | |||
267 | if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate)) | 267 | if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate)) |
268 | return -EINVAL; | 268 | return -EINVAL; |
269 | 269 | ||
270 | freqs.old = _speedstep_get(&policy->cpus); | 270 | freqs.old = _speedstep_get(policy->cpus); |
271 | freqs.new = speedstep_freqs[newstate].frequency; | 271 | freqs.new = speedstep_freqs[newstate].frequency; |
272 | freqs.cpu = policy->cpu; | 272 | freqs.cpu = policy->cpu; |
273 | 273 | ||
@@ -279,20 +279,20 @@ static int speedstep_target (struct cpufreq_policy *policy, | |||
279 | 279 | ||
280 | cpus_allowed = current->cpus_allowed; | 280 | cpus_allowed = current->cpus_allowed; |
281 | 281 | ||
282 | for_each_cpu_mask_nr(i, policy->cpus) { | 282 | for_each_cpu(i, policy->cpus) { |
283 | freqs.cpu = i; | 283 | freqs.cpu = i; |
284 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 284 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
285 | } | 285 | } |
286 | 286 | ||
287 | /* switch to physical CPU where state is to be changed */ | 287 | /* switch to physical CPU where state is to be changed */ |
288 | set_cpus_allowed_ptr(current, &policy->cpus); | 288 | set_cpus_allowed_ptr(current, policy->cpus); |
289 | 289 | ||
290 | speedstep_set_state(newstate); | 290 | speedstep_set_state(newstate); |
291 | 291 | ||
292 | /* allow to be run on all CPUs */ | 292 | /* allow to be run on all CPUs */ |
293 | set_cpus_allowed_ptr(current, &cpus_allowed); | 293 | set_cpus_allowed_ptr(current, &cpus_allowed); |
294 | 294 | ||
295 | for_each_cpu_mask_nr(i, policy->cpus) { | 295 | for_each_cpu(i, policy->cpus) { |
296 | freqs.cpu = i; | 296 | freqs.cpu = i; |
297 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 297 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
298 | } | 298 | } |
@@ -322,11 +322,11 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
322 | 322 | ||
323 | /* only run on CPU to be set, or on its sibling */ | 323 | /* only run on CPU to be set, or on its sibling */ |
324 | #ifdef CONFIG_SMP | 324 | #ifdef CONFIG_SMP |
325 | policy->cpus = per_cpu(cpu_sibling_map, policy->cpu); | 325 | cpumask_copy(policy->cpus, &per_cpu(cpu_sibling_map, policy->cpu)); |
326 | #endif | 326 | #endif |
327 | 327 | ||
328 | cpus_allowed = current->cpus_allowed; | 328 | cpus_allowed = current->cpus_allowed; |
329 | set_cpus_allowed_ptr(current, &policy->cpus); | 329 | set_cpus_allowed_ptr(current, policy->cpus); |
330 | 330 | ||
331 | /* detect low and high frequency and transition latency */ | 331 | /* detect low and high frequency and transition latency */ |
332 | result = speedstep_get_freqs(speedstep_processor, | 332 | result = speedstep_get_freqs(speedstep_processor, |
@@ -339,7 +339,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
339 | return result; | 339 | return result; |
340 | 340 | ||
341 | /* get current speed setting */ | 341 | /* get current speed setting */ |
342 | speed = _speedstep_get(&policy->cpus); | 342 | speed = _speedstep_get(policy->cpus); |
343 | if (!speed) | 343 | if (!speed) |
344 | return -EIO; | 344 | return -EIO; |
345 | 345 | ||