Commit 97db7fbf authored by KAMEZAWA Hiroyuki's avatar KAMEZAWA Hiroyuki Committed by Linus Torvalds

[PATCH] for_each_possible_cpu: s390

for_each_cpu() actually iterates across all possible CPUs.  We've had mistakes
in the past where people were using for_each_cpu() where they should have been
iterating across only online or present CPUs.  This is inefficient and
possibly buggy.

We're renaming for_each_cpu() to for_each_possible_cpu() to avoid this in the
future.

This patch replaces for_each_cpu with for_each_possible_cpu.
Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3feb8856
...@@ -801,7 +801,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) ...@@ -801,7 +801,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
*/ */
print_cpu_info(&S390_lowcore.cpu_data); print_cpu_info(&S390_lowcore.cpu_data);
for_each_cpu(i) { for_each_possible_cpu(i) {
lowcore_ptr[i] = (struct _lowcore *) lowcore_ptr[i] = (struct _lowcore *)
__get_free_pages(GFP_KERNEL|GFP_DMA, __get_free_pages(GFP_KERNEL|GFP_DMA,
sizeof(void*) == 8 ? 1 : 0); sizeof(void*) == 8 ? 1 : 0);
...@@ -831,7 +831,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) ...@@ -831,7 +831,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
#endif #endif
set_prefix((u32)(unsigned long) lowcore_ptr[smp_processor_id()]); set_prefix((u32)(unsigned long) lowcore_ptr[smp_processor_id()]);
for_each_cpu(cpu) for_each_possible_cpu(cpu)
if (cpu != smp_processor_id()) if (cpu != smp_processor_id())
smp_create_idle(cpu); smp_create_idle(cpu);
} }
...@@ -868,7 +868,7 @@ static int __init topology_init(void) ...@@ -868,7 +868,7 @@ static int __init topology_init(void)
int cpu; int cpu;
int ret; int ret;
for_each_cpu(cpu) { for_each_possible_cpu(cpu) {
ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL); ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL);
if (ret) if (ret)
printk(KERN_WARNING "topology_init: register_cpu %d " printk(KERN_WARNING "topology_init: register_cpu %d "
......
...@@ -46,7 +46,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; ...@@ -46,7 +46,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
#define percpu_modcopy(pcpudst, src, size) \ #define percpu_modcopy(pcpudst, src, size) \
do { \ do { \
unsigned int __i; \ unsigned int __i; \
for_each_cpu(__i) \ for_each_possible_cpu(__i) \
memcpy((pcpudst)+__per_cpu_offset[__i], \ memcpy((pcpudst)+__per_cpu_offset[__i], \
(src), (size)); \ (src), (size)); \
} while (0) } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment