diff -urN linux-2.5.12/include/linux/page-flags.h linux/include/linux/page-flags.h --- linux-2.5.12/include/linux/page-flags.h Wed May 1 08:40:14 2002 +++ linux/include/linux/page-flags.h Wed May 1 11:51:43 2002 @@ -42,6 +42,8 @@ * address space... */ +#include + /* * Don't use the *_dontuse flags. Use the macros. Otherwise you'll break * locked- and dirty-page accounting. The top eight bits of page->flags are @@ -69,18 +71,20 @@ /* * Global page accounting. One instance per CPU. */ -extern struct page_state { +struct page_state { unsigned long nr_dirty; unsigned long nr_locked; unsigned long nr_pagecache; -} ____cacheline_aligned_in_smp page_states[NR_CPUS]; +}; + +extern struct page_state __per_cpu_data page_states; extern void get_page_state(struct page_state *ret); #define mod_page_state(member, delta) \ do { \ preempt_disable(); \ - page_states[smp_processor_id()].member += (delta); \ + this_cpu(page_states).member += (delta); \ preempt_enable(); \ } while (0) diff -urN linux-2.5.12/mm/page_alloc.c linux/mm/page_alloc.c --- linux-2.5.12/mm/page_alloc.c Wed May 1 08:40:14 2002 +++ linux/mm/page_alloc.c Wed May 1 11:51:05 2002 @@ -576,7 +576,7 @@ * The result is unavoidably approximate - it can change * during and after execution of this function. */ -struct page_state page_states[NR_CPUS] __cacheline_aligned; +struct page_state __per_cpu_data page_states; EXPORT_SYMBOL(page_states); void get_page_state(struct page_state *ret) @@ -590,7 +590,7 @@ for (pcpu = 0; pcpu < smp_num_cpus; pcpu++) { struct page_state *ps; - ps = &page_states[cpu_logical_map(pcpu)]; + ps = &per_cpu(page_states,cpu_logical_map(pcpu)); ret->nr_dirty += ps->nr_dirty; ret->nr_locked += ps->nr_locked; ret->nr_pagecache += ps->nr_pagecache;