Skip to content

Commit

Permalink
[PATCH] for_each_possible_cpu: ppc
Browse files Browse the repository at this point in the history
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: KAMEZAWA Hiroyuki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
  • Loading branch information
hkamezawa authored and paulusmack committed Mar 29, 2006
1 parent 0e55195 commit b848e0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/ppc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ int __init ppc_init(void)
if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff);

/* register CPU devices */
for_each_cpu(i)
for_each_possible_cpu(i)
register_cpu(&cpu_devices[i], i, NULL);

/* call platform init */
Expand Down
2 changes: 1 addition & 1 deletion arch/ppc/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
/* Backup CPU 0 state */
__save_cpu_setup();

for_each_cpu(cpu) {
for_each_possible_cpu(cpu) {
if (cpu == smp_processor_id())
continue;
/* create a process for the processor */
Expand Down

0 comments on commit b848e0a

Please sign in to comment.