Skip to contentSkip to conversation

percpu: fix percpu accessors to potentially !cpu_possible() cpus: m32r

PATCH In review Rusty Russell 2 participants 2 messages Nov 21, 2008 – Nov 27, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 percpu: fix percpu accessors to potentially !cpu_possible() cpus: m32r

Impact: CPU iterator bugfixes

Percpu areas are only allocated for possible cpus. In general, you shouldn't access random cpu's percpu areas.

---
 arch/m32r/kernel/smpboot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m32r/kernel/smpboot.c +1 -1
@@ -598,7 +598,7 @@ int setup_profiling_timer(unsigned int m
 	 * accounting. At that time they also adjust their APIC timers
 	 * accordingly.
 	 */
-	for (i = 0; i < NR_CPUS; ++i)
+	for_each_possible_cpu(i)
 		per_cpu(prof_multiplier, i) = multiplier;
 
 	return 0;
Acked-by on v1 1/3
#1 lore raw
Quoted 26 lines · Rusty Russell

Impact: CPU iterator bugfixes

Percpu areas are only allocated for possible cpus. In general, you shouldn't access random cpu's percpu areas.

---
 arch/m32r/kernel/smpboot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m32r/kernel/smpboot.c +1 -1
@@ -598,7 +598,7 @@ int setup_profiling_timer(unsigned int m
 	 * accounting. At that time they also adjust their APIC timers
 	 * accordingly.
 	 */
-	for (i = 0; i < NR_CPUS; ++i)
+	for_each_possible_cpu(i)
 		per_cpu(prof_multiplier, i) = multiplier;
 
 	return 0;