diff options
author | Andrew Morton <akpm@osdl.org> | 2006-03-22 03:07:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-22 10:53:55 -0500 |
commit | b40607fc02f8248828d52d88f91b7d68df1933b0 (patch) | |
tree | 4e29b252e6bf8d520de092edfeb9bc60413d92cb /mm/page_alloc.c | |
parent | 68ed0040a8c9d06b73cda322a1f740749bd6e41a (diff) |
[PATCH] __get_page_state() cpumask cleanup and fix
__get_page_state() has an open-coded for_each_cpu_mask() loop in it.
Tidy that up, then notice that the code was buggy:
while (cpu < NR_CPUS) {
unsigned long *in, *out, off;
if (!cpu_isset(cpu, *cpumask))
continue;
an obvious infinite loop. I guess we just never call it with a holey cpu
mask.
Even after my cpumask size-reduction work, this patch increases code size :(
Cc: Paul Jackson <pj@sgi.com>
Cc: Christoph Lameter <clameter@engr.sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 234bd4895d14..61775866ea18 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1214,24 +1214,22 @@ DEFINE_PER_CPU(long, nr_pagecache_local) = 0; | |||
1214 | 1214 | ||
1215 | static void __get_page_state(struct page_state *ret, int nr, cpumask_t *cpumask) | 1215 | static void __get_page_state(struct page_state *ret, int nr, cpumask_t *cpumask) |
1216 | { | 1216 | { |
1217 | int cpu = 0; | 1217 | unsigned cpu; |
1218 | 1218 | ||
1219 | memset(ret, 0, nr * sizeof(unsigned long)); | 1219 | memset(ret, 0, nr * sizeof(unsigned long)); |
1220 | cpus_and(*cpumask, *cpumask, cpu_online_map); | 1220 | cpus_and(*cpumask, *cpumask, cpu_online_map); |
1221 | 1221 | ||
1222 | cpu = first_cpu(*cpumask); | 1222 | for_each_cpu_mask(cpu, *cpumask) { |
1223 | while (cpu < NR_CPUS) { | 1223 | unsigned long *in; |
1224 | unsigned long *in, *out, off; | 1224 | unsigned long *out; |
1225 | 1225 | unsigned off; | |
1226 | if (!cpu_isset(cpu, *cpumask)) | 1226 | unsigned next_cpu; |
1227 | continue; | ||
1228 | 1227 | ||
1229 | in = (unsigned long *)&per_cpu(page_states, cpu); | 1228 | in = (unsigned long *)&per_cpu(page_states, cpu); |
1230 | 1229 | ||
1231 | cpu = next_cpu(cpu, *cpumask); | 1230 | next_cpu = next_cpu(cpu, *cpumask); |
1232 | 1231 | if (likely(next_cpu < NR_CPUS)) | |
1233 | if (likely(cpu < NR_CPUS)) | 1232 | prefetch(&per_cpu(page_states, next_cpu)); |
1234 | prefetch(&per_cpu(page_states, cpu)); | ||
1235 | 1233 | ||
1236 | out = (unsigned long *)ret; | 1234 | out = (unsigned long *)ret; |
1237 | for (off = 0; off < nr; off++) | 1235 | for (off = 0; off < nr; off++) |