]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Add prefetching to get_page_state()
authorAndrew Morton <akpm@digeo.com>
Sat, 14 Dec 2002 11:19:34 +0000 (03:19 -0800)
committerJaroslav Kysela <perex@suse.cz>
Sat, 14 Dec 2002 11:19:34 +0000 (03:19 -0800)
Fetch the next cacheline as we're counting up the fields in this one.

mm/page_alloc.c

index 3e062d19efbaa5553f88e9cb156f4e540a496864..84550e8c4ba02fe5377f7926cc18494f1716ad93 100644 (file)
@@ -715,16 +715,21 @@ EXPORT_PER_CPU_SYMBOL(page_states);
 
 void __get_page_state(struct page_state *ret, int nr)
 {
-       int cpu;
+       int cpu = 0;
 
        memset(ret, 0, sizeof(*ret));
-       for (cpu = 0; cpu < NR_CPUS; cpu++) {
+       while (cpu < NR_CPUS) {
                unsigned long *in, *out, off;
 
-               if (!cpu_online(cpu))
+               if (!cpu_online(cpu)) {
+                       cpu++;
                        continue;
+               }
 
                in = (unsigned long *)&per_cpu(page_states, cpu);
+               cpu++;
+               if (cpu < NR_CPUS && cpu_online(cpu))
+                       prefetch(&per_cpu(page_states, cpu));
                out = (unsigned long *)ret;
                for (off = 0; off < nr; off++)
                        *out++ += *in++;