diff options
author | Andrew Morton <akpm@osdl.org> | 2006-03-23 06:01:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:17 -0500 |
commit | 394e3902c55e667945f6f1c2bdbc59842cce70f7 (patch) | |
tree | f4bca0bdc0c291fda6f6949265aacec0669b9084 /arch/xtensa/kernel | |
parent | 63872f87a151413100678f110d1556026002809e (diff) |
[PATCH] more for_each_cpu() conversions
When we stop allocating percpu memory for not-possible CPUs we must not touch
the percpu data for not-possible CPUs at all. The correct way of doing this
is to test cpu_possible() or to use for_each_cpu().
This patch is a kernel-wide sweep of all instances of NR_CPUS. I found very
few instances of this bug, if any. But the patch converts lots of open-coded
test to use the preferred helper macros.
Cc: Mikael Starvik <starvik@axis.com>
Cc: David Howells <dhowells@redhat.com>
Acked-by: Kyle McMartin <kyle@parisc-linux.org>
Cc: Anton Blanchard <anton@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: William Lee Irwin III <wli@holomorphy.com>
Cc: Andi Kleen <ak@muc.de>
Cc: Christian Zankel <chris@zankel.net>
Cc: Philippe Elie <phil.el@wanadoo.fr>
Cc: Nathan Scott <nathans@sgi.com>
Cc: Jens Axboe <axboe@suse.de>
Cc: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/xtensa/kernel')
-rw-r--r-- | arch/xtensa/kernel/irq.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c index 4cbf6d91571f..51f9bed455fa 100644 --- a/arch/xtensa/kernel/irq.c +++ b/arch/xtensa/kernel/irq.c | |||
@@ -83,9 +83,8 @@ int show_interrupts(struct seq_file *p, void *v) | |||
83 | 83 | ||
84 | if (i == 0) { | 84 | if (i == 0) { |
85 | seq_printf(p, " "); | 85 | seq_printf(p, " "); |
86 | for (j=0; j<NR_CPUS; j++) | 86 | for_each_online_cpu(j) |
87 | if (cpu_online(j)) | 87 | seq_printf(p, "CPU%d ",j); |
88 | seq_printf(p, "CPU%d ",j); | ||
89 | seq_putc(p, '\n'); | 88 | seq_putc(p, '\n'); |
90 | } | 89 | } |
91 | 90 | ||
@@ -98,9 +97,8 @@ int show_interrupts(struct seq_file *p, void *v) | |||
98 | #ifndef CONFIG_SMP | 97 | #ifndef CONFIG_SMP |
99 | seq_printf(p, "%10u ", kstat_irqs(i)); | 98 | seq_printf(p, "%10u ", kstat_irqs(i)); |
100 | #else | 99 | #else |
101 | for (j = 0; j < NR_CPUS; j++) | 100 | for_each_online_cpu(j) |
102 | if (cpu_online(j)) | 101 | seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); |
103 | seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); | ||
104 | #endif | 102 | #endif |
105 | seq_printf(p, " %14s", irq_desc[i].handler->typename); | 103 | seq_printf(p, " %14s", irq_desc[i].handler->typename); |
106 | seq_printf(p, " %s", action->name); | 104 | seq_printf(p, " %s", action->name); |
@@ -113,9 +111,8 @@ skip: | |||
113 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 111 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
114 | } else if (i == NR_IRQS) { | 112 | } else if (i == NR_IRQS) { |
115 | seq_printf(p, "NMI: "); | 113 | seq_printf(p, "NMI: "); |
116 | for (j = 0; j < NR_CPUS; j++) | 114 | for_each_online_cpu(j) |
117 | if (cpu_online(j)) | 115 | seq_printf(p, "%10u ", nmi_count(j)); |
118 | seq_printf(p, "%10u ", nmi_count(j)); | ||
119 | seq_putc(p, '\n'); | 116 | seq_putc(p, '\n'); |
120 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | 117 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); |
121 | } | 118 | } |