summaryrefslogtreecommitdiff
path: root/mm/slob.c
diff options
context:
space:
mode:
authorJohn Hawkes <hawkes@sgi.com>2006-04-19 09:20:33 +0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-19 20:13:49 +0400
commit75129e297e861e6c61038aa4cdbf604b022de4ff (patch)
tree48392ab6ae43547ae2d81a312eb22708af0dc515 /mm/slob.c
parent4a3b98a422a20dedf3a2a40c44892d6e7e665157 (diff)
downloadlinux-75129e297e861e6c61038aa4cdbf604b022de4ff.tar.xz
[PATCH] mm/slob.c: for_each_possible_cpu(), not NR_CPUS
Convert for-loops that explicitly reference "NR_CPUS" into the potentially more efficient for_each_possible_cpu() construct. Signed-off-by: John Hawkes <hawkes@sgi.com> Cc: Matt Mackall <mpm@selenic.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/slob.c')
-rw-r--r--mm/slob.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/mm/slob.c b/mm/slob.c
index 9bcc7e2cabfd..a68255ba4553 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -354,9 +354,7 @@ void *__alloc_percpu(size_t size)
if (!pdata)
return NULL;
- for (i = 0; i < NR_CPUS; i++) {
- if (!cpu_possible(i))
- continue;
+ for_each_possible_cpu(i) {
pdata->ptrs[i] = kmalloc(size, GFP_KERNEL);
if (!pdata->ptrs[i])
goto unwind_oom;
@@ -383,11 +381,9 @@ free_percpu(const void *objp)
int i;
struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp);
- for (i = 0; i < NR_CPUS; i++) {
- if (!cpu_possible(i))
- continue;
+ for_each_possible_cpu(i)
kfree(p->ptrs[i]);
- }
+
kfree(p);
}
EXPORT_SYMBOL(free_percpu);