diff options
| author | Andrew Morton <akpm@digeo.com> | 2002-10-29 23:32:18 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@penguin.transmeta.com> | 2002-10-29 23:32:18 -0800 |
| commit | afce7191a73f632a138f5511cbe245d39c526331 (patch) | |
| tree | 656fbba4cc86378f7a83a1089f7c8cb3477fe5bc /include/linux | |
| parent | 999eac41b129b96ec511344e963acae34d26a0b1 (diff) | |
[PATCH] percpu: convert global page accounting
Convert global page state accounting to use per-cpu storage
(I think this code remains a little buggy, btw. Note how I do
per_cpu(page_states, cpu).member += (delta);
This gets done at interrupt time and hence is assuming that
the "+=" operation on a ulong is atomic wrt interrupts on
all architectures. How do we feel about that assumption?)
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/gfp.h | 2 | ||||
| -rw-r--r-- | include/linux/page-flags.h | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 939f16910233..c340b447a963 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -86,4 +86,6 @@ extern void FASTCALL(free_pages(unsigned long addr, unsigned int order)); #define __free_page(page) __free_pages((page), 0) #define free_page(addr) free_pages((addr),0) +void page_alloc_init(void); + #endif /* __LINUX_GFP_H */ diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 5c770f49787a..282902bb9816 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -5,6 +5,8 @@ #ifndef PAGE_FLAGS_H #define PAGE_FLAGS_H +#include <linux/percpu.h> + /* * Various page->flags bits: * @@ -73,7 +75,7 @@ * Global page accounting. One instance per CPU. Only unsigned longs are * allowed. */ -extern struct page_state { +struct page_state { unsigned long nr_dirty; unsigned long nr_writeback; unsigned long nr_pagecache; @@ -103,7 +105,9 @@ extern struct page_state { unsigned long kswapd_steal; unsigned long pageoutrun; unsigned long allocstall; -} ____cacheline_aligned_in_smp page_states[NR_CPUS]; +}; + +DECLARE_PER_CPU(struct page_state, page_states); extern void get_page_state(struct page_state *ret); extern void get_full_page_state(struct page_state *ret); @@ -111,7 +115,7 @@ extern void get_full_page_state(struct page_state *ret); #define mod_page_state(member, delta) \ do { \ int cpu = get_cpu(); \ - page_states[cpu].member += (delta); \ + per_cpu(page_states, cpu).member += (delta); \ put_cpu(); \ } while (0) |
