Commit 351419e2 authored by Andrew Morton's avatar Andrew Morton Committed by Jaroslav Kysela

[PATCH] Add prefetching to get_page_state()

Fetch the next cacheline as we're counting up the fields in this one.
parent 7cc9ee3d
......@@ -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++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment