diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-09 11:48:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-09 11:48:32 -0400 |
commit | 13df635f080d411a152c92087a384135c1562fac (patch) | |
tree | 71330df816c147e2c11dc68dfbd39a0c296cb163 | |
parent | 9cdba30283ecad22970e954c5595c9079d7a7f63 (diff) | |
parent | 8437a617708d014d6f220df201a24960e00d57b1 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
kvm: fix kvm reboot crash when MAXSMP is used
cpumask: alloc zeroed cpumask for static cpumask_var_ts
cpumask: introduce zalloc_cpumask_var
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/powernow-k7.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/tlb_uv.c | 2 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 2 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 2 | ||||
-rw-r--r-- | include/linux/cpumask.h | 15 | ||||
-rw-r--r-- | kernel/sched_cpupri.c | 2 | ||||
-rw-r--r-- | kernel/sched_rt.c | 2 | ||||
-rw-r--r-- | kernel/smp.c | 2 | ||||
-rw-r--r-- | lib/cpumask.c | 12 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 2 |
14 files changed, 39 insertions, 12 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 54b6de2cd947..752e8c6b2c7e 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -550,7 +550,7 @@ static int __init acpi_cpufreq_early_init(void) | |||
550 | return -ENOMEM; | 550 | return -ENOMEM; |
551 | } | 551 | } |
552 | for_each_possible_cpu(i) { | 552 | for_each_possible_cpu(i) { |
553 | if (!alloc_cpumask_var_node( | 553 | if (!zalloc_cpumask_var_node( |
554 | &per_cpu_ptr(acpi_perf_data, i)->shared_cpu_map, | 554 | &per_cpu_ptr(acpi_perf_data, i)->shared_cpu_map, |
555 | GFP_KERNEL, cpu_to_node(i))) { | 555 | GFP_KERNEL, cpu_to_node(i))) { |
556 | 556 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c index a8363e5be4ef..d47c775eb0ab 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c | |||
@@ -322,7 +322,7 @@ static int powernow_acpi_init(void) | |||
322 | goto err0; | 322 | goto err0; |
323 | } | 323 | } |
324 | 324 | ||
325 | if (!alloc_cpumask_var(&acpi_processor_perf->shared_cpu_map, | 325 | if (!zalloc_cpumask_var(&acpi_processor_perf->shared_cpu_map, |
326 | GFP_KERNEL)) { | 326 | GFP_KERNEL)) { |
327 | retval = -ENOMEM; | 327 | retval = -ENOMEM; |
328 | goto err05; | 328 | goto err05; |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index 35dc8fbe92bd..cf52215d9eb1 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -887,7 +887,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) | |||
887 | /* notify BIOS that we exist */ | 887 | /* notify BIOS that we exist */ |
888 | acpi_processor_notify_smm(THIS_MODULE); | 888 | acpi_processor_notify_smm(THIS_MODULE); |
889 | 889 | ||
890 | if (!alloc_cpumask_var(&data->acpi_data.shared_cpu_map, GFP_KERNEL)) { | 890 | if (!zalloc_cpumask_var(&data->acpi_data.shared_cpu_map, GFP_KERNEL)) { |
891 | printk(KERN_ERR PFX | 891 | printk(KERN_ERR PFX |
892 | "unable to alloc powernow_k8_data cpumask\n"); | 892 | "unable to alloc powernow_k8_data cpumask\n"); |
893 | ret_val = -ENOMEM; | 893 | ret_val = -ENOMEM; |
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c index c9f1fdc02830..55c831ed71ce 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c | |||
@@ -471,7 +471,7 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
471 | 471 | ||
472 | if (unlikely(!alloc_cpumask_var(&saved_mask, GFP_KERNEL))) | 472 | if (unlikely(!alloc_cpumask_var(&saved_mask, GFP_KERNEL))) |
473 | return -ENOMEM; | 473 | return -ENOMEM; |
474 | if (unlikely(!alloc_cpumask_var(&covered_cpus, GFP_KERNEL))) { | 474 | if (unlikely(!zalloc_cpumask_var(&covered_cpus, GFP_KERNEL))) { |
475 | free_cpumask_var(saved_mask); | 475 | free_cpumask_var(saved_mask); |
476 | return -ENOMEM; | 476 | return -ENOMEM; |
477 | } | 477 | } |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c index 6fb0b359d2a5..09dd1d414fc3 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_64.c | |||
@@ -1163,7 +1163,7 @@ static __init int mce_init_device(void) | |||
1163 | if (!mce_available(&boot_cpu_data)) | 1163 | if (!mce_available(&boot_cpu_data)) |
1164 | return -EIO; | 1164 | return -EIO; |
1165 | 1165 | ||
1166 | alloc_cpumask_var(&mce_device_initialized, GFP_KERNEL); | 1166 | zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL); |
1167 | 1167 | ||
1168 | err = mce_init_banks(); | 1168 | err = mce_init_banks(); |
1169 | if (err) | 1169 | if (err) |
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c index ed0c33761e6d..8c7b03b0cfcb 100644 --- a/arch/x86/kernel/tlb_uv.c +++ b/arch/x86/kernel/tlb_uv.c | |||
@@ -832,7 +832,7 @@ static int __init uv_bau_init(void) | |||
832 | return 0; | 832 | return 0; |
833 | 833 | ||
834 | for_each_possible_cpu(cur_cpu) | 834 | for_each_possible_cpu(cur_cpu) |
835 | alloc_cpumask_var_node(&per_cpu(uv_flush_tlb_mask, cur_cpu), | 835 | zalloc_cpumask_var_node(&per_cpu(uv_flush_tlb_mask, cur_cpu), |
836 | GFP_KERNEL, cpu_to_node(cur_cpu)); | 836 | GFP_KERNEL, cpu_to_node(cur_cpu)); |
837 | 837 | ||
838 | uv_bau_retry_limit = 1; | 838 | uv_bau_retry_limit = 1; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 45ad3288c5ff..23f0fb84f1c1 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -844,7 +844,7 @@ static int acpi_processor_add(struct acpi_device *device) | |||
844 | if (!pr) | 844 | if (!pr) |
845 | return -ENOMEM; | 845 | return -ENOMEM; |
846 | 846 | ||
847 | if (!alloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) { | 847 | if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) { |
848 | kfree(pr); | 848 | kfree(pr); |
849 | return -ENOMEM; | 849 | return -ENOMEM; |
850 | } | 850 | } |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 47d2ad0ae079..6e2ec0b18948 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -808,7 +808,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
808 | ret = -ENOMEM; | 808 | ret = -ENOMEM; |
809 | goto nomem_out; | 809 | goto nomem_out; |
810 | } | 810 | } |
811 | if (!alloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) { | 811 | if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) { |
812 | free_cpumask_var(policy->cpus); | 812 | free_cpumask_var(policy->cpus); |
813 | kfree(policy); | 813 | kfree(policy); |
814 | ret = -ENOMEM; | 814 | ret = -ENOMEM; |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 9f315382610b..c5ac87ca7bc6 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -1022,6 +1022,8 @@ typedef struct cpumask *cpumask_var_t; | |||
1022 | 1022 | ||
1023 | bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); | 1023 | bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); |
1024 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); | 1024 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); |
1025 | bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); | ||
1026 | bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); | ||
1025 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); | 1027 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); |
1026 | void free_cpumask_var(cpumask_var_t mask); | 1028 | void free_cpumask_var(cpumask_var_t mask); |
1027 | void free_bootmem_cpumask_var(cpumask_var_t mask); | 1029 | void free_bootmem_cpumask_var(cpumask_var_t mask); |
@@ -1040,6 +1042,19 @@ static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, | |||
1040 | return true; | 1042 | return true; |
1041 | } | 1043 | } |
1042 | 1044 | ||
1045 | static inline bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | ||
1046 | { | ||
1047 | cpumask_clear(*mask); | ||
1048 | return true; | ||
1049 | } | ||
1050 | |||
1051 | static inline bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, | ||
1052 | int node) | ||
1053 | { | ||
1054 | cpumask_clear(*mask); | ||
1055 | return true; | ||
1056 | } | ||
1057 | |||
1043 | static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) | 1058 | static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) |
1044 | { | 1059 | { |
1045 | } | 1060 | } |
diff --git a/kernel/sched_cpupri.c b/kernel/sched_cpupri.c index cdd3c89574cd..344712a5e3ed 100644 --- a/kernel/sched_cpupri.c +++ b/kernel/sched_cpupri.c | |||
@@ -165,7 +165,7 @@ int __init_refok cpupri_init(struct cpupri *cp, bool bootmem) | |||
165 | vec->count = 0; | 165 | vec->count = 0; |
166 | if (bootmem) | 166 | if (bootmem) |
167 | alloc_bootmem_cpumask_var(&vec->mask); | 167 | alloc_bootmem_cpumask_var(&vec->mask); |
168 | else if (!alloc_cpumask_var(&vec->mask, GFP_KERNEL)) | 168 | else if (!zalloc_cpumask_var(&vec->mask, GFP_KERNEL)) |
169 | goto cleanup; | 169 | goto cleanup; |
170 | } | 170 | } |
171 | 171 | ||
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index f2c66f8f9712..9bf0d2a73045 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -1591,7 +1591,7 @@ static inline void init_sched_rt_class(void) | |||
1591 | unsigned int i; | 1591 | unsigned int i; |
1592 | 1592 | ||
1593 | for_each_possible_cpu(i) | 1593 | for_each_possible_cpu(i) |
1594 | alloc_cpumask_var_node(&per_cpu(local_cpu_mask, i), | 1594 | zalloc_cpumask_var_node(&per_cpu(local_cpu_mask, i), |
1595 | GFP_KERNEL, cpu_to_node(i)); | 1595 | GFP_KERNEL, cpu_to_node(i)); |
1596 | } | 1596 | } |
1597 | #endif /* CONFIG_SMP */ | 1597 | #endif /* CONFIG_SMP */ |
diff --git a/kernel/smp.c b/kernel/smp.c index 858baac568ee..ad63d8501207 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -52,7 +52,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) | |||
52 | switch (action) { | 52 | switch (action) { |
53 | case CPU_UP_PREPARE: | 53 | case CPU_UP_PREPARE: |
54 | case CPU_UP_PREPARE_FROZEN: | 54 | case CPU_UP_PREPARE_FROZEN: |
55 | if (!alloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL, | 55 | if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL, |
56 | cpu_to_node(cpu))) | 56 | cpu_to_node(cpu))) |
57 | return NOTIFY_BAD; | 57 | return NOTIFY_BAD; |
58 | break; | 58 | break; |
diff --git a/lib/cpumask.c b/lib/cpumask.c index 1f71b97de0f9..eb23aaa0c7b8 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c | |||
@@ -119,6 +119,12 @@ bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) | |||
119 | } | 119 | } |
120 | EXPORT_SYMBOL(alloc_cpumask_var_node); | 120 | EXPORT_SYMBOL(alloc_cpumask_var_node); |
121 | 121 | ||
122 | bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) | ||
123 | { | ||
124 | return alloc_cpumask_var_node(mask, flags | __GFP_ZERO, node); | ||
125 | } | ||
126 | EXPORT_SYMBOL(zalloc_cpumask_var_node); | ||
127 | |||
122 | /** | 128 | /** |
123 | * alloc_cpumask_var - allocate a struct cpumask | 129 | * alloc_cpumask_var - allocate a struct cpumask |
124 | * @mask: pointer to cpumask_var_t where the cpumask is returned | 130 | * @mask: pointer to cpumask_var_t where the cpumask is returned |
@@ -135,6 +141,12 @@ bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | |||
135 | } | 141 | } |
136 | EXPORT_SYMBOL(alloc_cpumask_var); | 142 | EXPORT_SYMBOL(alloc_cpumask_var); |
137 | 143 | ||
144 | bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | ||
145 | { | ||
146 | return alloc_cpumask_var(mask, flags | __GFP_ZERO); | ||
147 | } | ||
148 | EXPORT_SYMBOL(zalloc_cpumask_var); | ||
149 | |||
138 | /** | 150 | /** |
139 | * alloc_bootmem_cpumask_var - allocate a struct cpumask from the bootmem arena. | 151 | * alloc_bootmem_cpumask_var - allocate a struct cpumask from the bootmem arena. |
140 | * @mask: pointer to cpumask_var_t where the cpumask is returned | 152 | * @mask: pointer to cpumask_var_t where the cpumask is returned |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 4293528200b3..4d0dd390aa50 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -2301,7 +2301,7 @@ int kvm_init(void *opaque, unsigned int vcpu_size, | |||
2301 | 2301 | ||
2302 | bad_pfn = page_to_pfn(bad_page); | 2302 | bad_pfn = page_to_pfn(bad_page); |
2303 | 2303 | ||
2304 | if (!alloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) { | 2304 | if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) { |
2305 | r = -ENOMEM; | 2305 | r = -ENOMEM; |
2306 | goto out_free_0; | 2306 | goto out_free_0; |
2307 | } | 2307 | } |