aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2006-03-28 04:56:37 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 12:16:05 -0500
commit0a945022778f100115d0cb6234eb28fc1b15ccaf (patch)
tree85df4b5f7dd8bf59557091379c59b23b09115bf6
parent631d6747e1d877a4baa924cb373b8b9511a53e5e (diff)
[PATCH] for_each_possible_cpu: fixes for generic part
replaces for_each_cpu with for_each_possible_cpu(). Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--block/ll_rw_blk.c2
-rw-r--r--fs/file.c2
-rw-r--r--fs/proc/proc_misc.c2
-rw-r--r--include/asm-generic/percpu.h2
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--init/main.c2
-rw-r--r--kernel/rcutorture.c4
-rw-r--r--kernel/sched.c8
-rw-r--r--mm/slab.c4
-rw-r--r--mm/swap.c2
11 files changed, 17 insertions, 17 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 82469db25100..5a19e2eb5711 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3514,7 +3514,7 @@ int __init blk_dev_init(void)
3514 iocontext_cachep = kmem_cache_create("blkdev_ioc", 3514 iocontext_cachep = kmem_cache_create("blkdev_ioc",
3515 sizeof(struct io_context), 0, SLAB_PANIC, NULL, NULL); 3515 sizeof(struct io_context), 0, SLAB_PANIC, NULL, NULL);
3516 3516
3517 for_each_cpu(i) 3517 for_each_possible_cpu(i)
3518 INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i)); 3518 INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i));
3519 3519
3520 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL); 3520 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL);
diff --git a/fs/file.c b/fs/file.c
index bbc743314730..55f4e7022563 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -373,6 +373,6 @@ static void __devinit fdtable_defer_list_init(int cpu)
373void __init files_defer_init(void) 373void __init files_defer_init(void)
374{ 374{
375 int i; 375 int i;
376 for_each_cpu(i) 376 for_each_possible_cpu(i)
377 fdtable_defer_list_init(i); 377 fdtable_defer_list_init(i);
378} 378}
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 1e9ea37d457e..1edce0c34bfd 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -534,7 +534,7 @@ static int show_stat(struct seq_file *p, void *v)
534 if (wall_to_monotonic.tv_nsec) 534 if (wall_to_monotonic.tv_nsec)
535 --jif; 535 --jif;
536 536
537 for_each_cpu(i) { 537 for_each_possible_cpu(i) {
538 int j; 538 int j;
539 539
540 user = cputime64_add(user, kstat_cpu(i).cpustat.user); 540 user = cputime64_add(user, kstat_cpu(i).cpustat.user);
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 78cf45547e31..c0caf433a7d7 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -19,7 +19,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
19#define percpu_modcopy(pcpudst, src, size) \ 19#define percpu_modcopy(pcpudst, src, size) \
20do { \ 20do { \
21 unsigned int __i; \ 21 unsigned int __i; \
22 for_each_cpu(__i) \ 22 for_each_possible_cpu(__i) \
23 memcpy((pcpudst)+__per_cpu_offset[__i], \ 23 memcpy((pcpudst)+__per_cpu_offset[__i], \
24 (src), (size)); \ 24 (src), (size)); \
25} while (0) 25} while (0)
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 3c1b0294a742..10a27f29d692 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -152,14 +152,14 @@ struct disk_attribute {
152({ \ 152({ \
153 typeof(gendiskp->dkstats->field) res = 0; \ 153 typeof(gendiskp->dkstats->field) res = 0; \
154 int i; \ 154 int i; \
155 for_each_cpu(i) \ 155 for_each_possible_cpu(i) \
156 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \ 156 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \
157 res; \ 157 res; \
158}) 158})
159 159
160static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { 160static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) {
161 int i; 161 int i;
162 for_each_cpu(i) 162 for_each_possible_cpu(i)
163 memset(per_cpu_ptr(gendiskp->dkstats, i), value, 163 memset(per_cpu_ptr(gendiskp->dkstats, i), value,
164 sizeof (struct disk_stats)); 164 sizeof (struct disk_stats));
165} 165}
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index a484572c302e..b46249082cca 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -46,7 +46,7 @@ static inline int kstat_irqs(int irq)
46{ 46{
47 int cpu, sum = 0; 47 int cpu, sum = 0;
48 48
49 for_each_cpu(cpu) 49 for_each_possible_cpu(cpu)
50 sum += kstat_cpu(cpu).irqs[irq]; 50 sum += kstat_cpu(cpu).irqs[irq];
51 51
52 return sum; 52 return sum;
diff --git a/init/main.c b/init/main.c
index 64466ea1984c..4a2f0898dda1 100644
--- a/init/main.c
+++ b/init/main.c
@@ -341,7 +341,7 @@ static void __init setup_per_cpu_areas(void)
341#endif 341#endif
342 ptr = alloc_bootmem(size * nr_possible_cpus); 342 ptr = alloc_bootmem(size * nr_possible_cpus);
343 343
344 for_each_cpu(i) { 344 for_each_possible_cpu(i) {
345 __per_cpu_offset[i] = ptr - __per_cpu_start; 345 __per_cpu_offset[i] = ptr - __per_cpu_start;
346 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 346 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
347 ptr += size; 347 ptr += size;
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index b4b362b5baf5..8154e7589d12 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -301,7 +301,7 @@ rcu_torture_printk(char *page)
301 long pipesummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 }; 301 long pipesummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 };
302 long batchsummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 }; 302 long batchsummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 };
303 303
304 for_each_cpu(cpu) { 304 for_each_possible_cpu(cpu) {
305 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) { 305 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) {
306 pipesummary[i] += per_cpu(rcu_torture_count, cpu)[i]; 306 pipesummary[i] += per_cpu(rcu_torture_count, cpu)[i];
307 batchsummary[i] += per_cpu(rcu_torture_batch, cpu)[i]; 307 batchsummary[i] += per_cpu(rcu_torture_batch, cpu)[i];
@@ -535,7 +535,7 @@ rcu_torture_init(void)
535 atomic_set(&n_rcu_torture_error, 0); 535 atomic_set(&n_rcu_torture_error, 0);
536 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) 536 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++)
537 atomic_set(&rcu_torture_wcount[i], 0); 537 atomic_set(&rcu_torture_wcount[i], 0);
538 for_each_cpu(cpu) { 538 for_each_possible_cpu(cpu) {
539 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) { 539 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) {
540 per_cpu(rcu_torture_count, cpu)[i] = 0; 540 per_cpu(rcu_torture_count, cpu)[i] = 0;
541 per_cpu(rcu_torture_batch, cpu)[i] = 0; 541 per_cpu(rcu_torture_batch, cpu)[i] = 0;
diff --git a/kernel/sched.c b/kernel/sched.c
index 7854ee516b92..a9ecac398bb9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1625,7 +1625,7 @@ unsigned long nr_uninterruptible(void)
1625{ 1625{
1626 unsigned long i, sum = 0; 1626 unsigned long i, sum = 0;
1627 1627
1628 for_each_cpu(i) 1628 for_each_possible_cpu(i)
1629 sum += cpu_rq(i)->nr_uninterruptible; 1629 sum += cpu_rq(i)->nr_uninterruptible;
1630 1630
1631 /* 1631 /*
@@ -1642,7 +1642,7 @@ unsigned long long nr_context_switches(void)
1642{ 1642{
1643 unsigned long long i, sum = 0; 1643 unsigned long long i, sum = 0;
1644 1644
1645 for_each_cpu(i) 1645 for_each_possible_cpu(i)
1646 sum += cpu_rq(i)->nr_switches; 1646 sum += cpu_rq(i)->nr_switches;
1647 1647
1648 return sum; 1648 return sum;
@@ -1652,7 +1652,7 @@ unsigned long nr_iowait(void)
1652{ 1652{
1653 unsigned long i, sum = 0; 1653 unsigned long i, sum = 0;
1654 1654
1655 for_each_cpu(i) 1655 for_each_possible_cpu(i)
1656 sum += atomic_read(&cpu_rq(i)->nr_iowait); 1656 sum += atomic_read(&cpu_rq(i)->nr_iowait);
1657 1657
1658 return sum; 1658 return sum;
@@ -6080,7 +6080,7 @@ void __init sched_init(void)
6080 runqueue_t *rq; 6080 runqueue_t *rq;
6081 int i, j, k; 6081 int i, j, k;
6082 6082
6083 for_each_cpu(i) { 6083 for_each_possible_cpu(i) {
6084 prio_array_t *array; 6084 prio_array_t *array;
6085 6085
6086 rq = cpu_rq(i); 6086 rq = cpu_rq(i);
diff --git a/mm/slab.c b/mm/slab.c
index 681837499d7d..4cbf8bb13557 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3311,7 +3311,7 @@ void *__alloc_percpu(size_t size)
3311 * and we have no way of figuring out how to fix the array 3311 * and we have no way of figuring out how to fix the array
3312 * that we have allocated then.... 3312 * that we have allocated then....
3313 */ 3313 */
3314 for_each_cpu(i) { 3314 for_each_possible_cpu(i) {
3315 int node = cpu_to_node(i); 3315 int node = cpu_to_node(i);
3316 3316
3317 if (node_online(node)) 3317 if (node_online(node))
@@ -3398,7 +3398,7 @@ void free_percpu(const void *objp)
3398 /* 3398 /*
3399 * We allocate for all cpus so we cannot use for online cpu here. 3399 * We allocate for all cpus so we cannot use for online cpu here.
3400 */ 3400 */
3401 for_each_cpu(i) 3401 for_each_possible_cpu(i)
3402 kfree(p->ptrs[i]); 3402 kfree(p->ptrs[i]);
3403 kfree(p); 3403 kfree(p);
3404} 3404}
diff --git a/mm/swap.c b/mm/swap.c
index 91b7e2026f69..88895c249bc9 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -512,7 +512,7 @@ long percpu_counter_sum(struct percpu_counter *fbc)
512 512
513 spin_lock(&fbc->lock); 513 spin_lock(&fbc->lock);
514 ret = fbc->count; 514 ret = fbc->count;
515 for_each_cpu(cpu) { 515 for_each_possible_cpu(cpu) {
516 long *pcount = per_cpu_ptr(fbc->counters, cpu); 516 long *pcount = per_cpu_ptr(fbc->counters, cpu);
517 ret += *pcount; 517 ret += *pcount;
518 } 518 }