mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
[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>
This commit is contained in:
parent
68ed0040a8
commit
b40607fc02
1 changed files with 9 additions and 11 deletions
|
@ -1214,24 +1214,22 @@ DEFINE_PER_CPU(long, nr_pagecache_local) = 0;
|
||||||
|
|
||||||
static void __get_page_state(struct page_state *ret, int nr, cpumask_t *cpumask)
|
static void __get_page_state(struct page_state *ret, int nr, cpumask_t *cpumask)
|
||||||
{
|
{
|
||||||
int cpu = 0;
|
unsigned cpu;
|
||||||
|
|
||||||
memset(ret, 0, nr * sizeof(unsigned long));
|
memset(ret, 0, nr * sizeof(unsigned long));
|
||||||
cpus_and(*cpumask, *cpumask, cpu_online_map);
|
cpus_and(*cpumask, *cpumask, cpu_online_map);
|
||||||
|
|
||||||
cpu = first_cpu(*cpumask);
|
for_each_cpu_mask(cpu, *cpumask) {
|
||||||
while (cpu < NR_CPUS) {
|
unsigned long *in;
|
||||||
unsigned long *in, *out, off;
|
unsigned long *out;
|
||||||
|
unsigned off;
|
||||||
if (!cpu_isset(cpu, *cpumask))
|
unsigned next_cpu;
|
||||||
continue;
|
|
||||||
|
|
||||||
in = (unsigned long *)&per_cpu(page_states, cpu);
|
in = (unsigned long *)&per_cpu(page_states, cpu);
|
||||||
|
|
||||||
cpu = next_cpu(cpu, *cpumask);
|
next_cpu = next_cpu(cpu, *cpumask);
|
||||||
|
if (likely(next_cpu < NR_CPUS))
|
||||||
if (likely(cpu < NR_CPUS))
|
prefetch(&per_cpu(page_states, next_cpu));
|
||||||
prefetch(&per_cpu(page_states, cpu));
|
|
||||||
|
|
||||||
out = (unsigned long *)ret;
|
out = (unsigned long *)ret;
|
||||||
for (off = 0; off < nr; off++)
|
for (off = 0; off < nr; off++)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue