Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e551954 authored by KAMEZAWA Hiroyuki's avatar KAMEZAWA Hiroyuki Committed by Paul Mackerras
Browse files

[PATCH] for_each_possible_cpu: powerpc



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>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent bab70a4a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -379,7 +379,7 @@ void irq_ctx_init(void)
	struct thread_info *tp;
	int i;

	for_each_cpu(i) {
	for_each_possible_cpu(i) {
		memset((void *)softirq_ctx[i], 0, THREAD_SIZE);
		tp = softirq_ctx[i];
		tp->cpu = i;
+2 −2
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static unsigned long get_purr(void)
	unsigned long sum_purr = 0;
	int cpu;

	for_each_cpu(cpu) {
	for_each_possible_cpu(cpu) {
		sum_purr += lppaca[cpu].emulated_time_base;

#ifdef PURR_DEBUG
@@ -222,7 +222,7 @@ static unsigned long get_purr(void)
	int cpu;
	struct cpu_usage *cu;

	for_each_cpu(cpu) {
	for_each_possible_cpu(cpu) {
		cu = &per_cpu(cpu_usage_array, cpu);
		sum_purr += cu->current_tb;
	}
+2 −2
Original line number Diff line number Diff line
@@ -593,7 +593,7 @@ static void rtas_percpu_suspend_me(void *info)
		data->waiting = 0;
		data->args->args[data->args->nargs] =
			rtas_call(ibm_suspend_me_token, 0, 1, NULL);
		for_each_cpu(i)
		for_each_possible_cpu(i)
			plpar_hcall_norets(H_PROD,i);
	} else {
		data->waiting = -EBUSY;
@@ -626,7 +626,7 @@ static int rtas_ibm_suspend_me(struct rtas_args *args)
	/* Prod each CPU.  This won't hurt, and will wake
	 * anyone we successfully put to sleep with H_Join
	 */
	for_each_cpu(i)
	for_each_possible_cpu(i)
		plpar_hcall_norets(H_PROD, i);

	return data.waiting;
+1 −1
Original line number Diff line number Diff line
@@ -431,7 +431,7 @@ void __init smp_setup_cpu_maps(void)
	/*
	 * Do the sibling map; assume only two threads per processor.
	 */
	for_each_cpu(cpu) {
	for_each_possible_cpu(cpu) {
		cpu_set(cpu, cpu_sibling_map[cpu]);
		if (cpu_has_feature(CPU_FTR_SMT))
			cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
+1 −1
Original line number Diff line number Diff line
@@ -226,7 +226,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 */
Loading