[PATCH] for_each_possible_cpu: network codes
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 under /net Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
dd7ba3b8b1
commit
6f91204225
@@ -49,7 +49,7 @@ static int fold_prot_inuse(struct proto *proto)
|
||||
int res = 0;
|
||||
int cpu;
|
||||
|
||||
for_each_cpu(cpu)
|
||||
for_each_possible_cpu(cpu)
|
||||
res += proto->stats[cpu].inuse;
|
||||
|
||||
return res;
|
||||
@@ -91,7 +91,7 @@ fold_field(void *mib[], int offt)
|
||||
unsigned long res = 0;
|
||||
int i;
|
||||
|
||||
for_each_cpu(i) {
|
||||
for_each_possible_cpu(i) {
|
||||
res += *(((unsigned long *) per_cpu_ptr(mib[0], i)) + offt);
|
||||
res += *(((unsigned long *) per_cpu_ptr(mib[1], i)) + offt);
|
||||
}
|
||||
|
Reference in New Issue
Block a user