aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorNick Piggin <nickpiggin@yahoo.com.au>2006-01-06 03:11:20 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:29 -0500
commita74609fafa2e5cc31d558012abaaa55ec9ad9da4 (patch)
tree0be653692864d99da345b575dfe2083994ee1d21 /include/linux
parentd3cb487149bd706aa6aeb02042332a450978dc1c (diff)
[PATCH] mm: page_state opt
Optimise page_state manipulations by introducing interrupt unsafe accessors to page_state fields. Callers must provide their own locking (either disable interrupts or not update from interrupt context). Switch over the hot callsites that can easily be moved under interrupts off sections. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/page-flags.h43
1 files changed, 32 insertions, 11 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 32d09c8d952b..dede8d412dca 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -144,22 +144,33 @@ struct page_state {
144extern void get_page_state(struct page_state *ret); 144extern void get_page_state(struct page_state *ret);
145extern void get_page_state_node(struct page_state *ret, int node); 145extern void get_page_state_node(struct page_state *ret, int node);
146extern void get_full_page_state(struct page_state *ret); 146extern void get_full_page_state(struct page_state *ret);
147extern unsigned long __read_page_state(unsigned long offset); 147extern unsigned long read_page_state_offset(unsigned long offset);
148extern void __mod_page_state(unsigned long offset, unsigned long delta); 148extern void mod_page_state_offset(unsigned long offset, unsigned long delta);
149extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
149 150
150#define read_page_state(member) \ 151#define read_page_state(member) \
151 __read_page_state(offsetof(struct page_state, member)) 152 read_page_state_offset(offsetof(struct page_state, member))
152 153
153#define mod_page_state(member, delta) \ 154#define mod_page_state(member, delta) \
154 __mod_page_state(offsetof(struct page_state, member), (delta)) 155 mod_page_state_offset(offsetof(struct page_state, member), (delta))
155 156
156#define inc_page_state(member) mod_page_state(member, 1UL) 157#define __mod_page_state(member, delta) \
157#define dec_page_state(member) mod_page_state(member, 0UL - 1) 158 __mod_page_state_offset(offsetof(struct page_state, member), (delta))
158#define add_page_state(member,delta) mod_page_state(member, (delta))
159#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
160 159
161#define mod_page_state_zone(zone, member, delta) \ 160#define inc_page_state(member) mod_page_state(member, 1UL)
162 do { \ 161#define dec_page_state(member) mod_page_state(member, 0UL - 1)
162#define add_page_state(member,delta) mod_page_state(member, (delta))
163#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
164
165#define __inc_page_state(member) __mod_page_state(member, 1UL)
166#define __dec_page_state(member) __mod_page_state(member, 0UL - 1)
167#define __add_page_state(member,delta) __mod_page_state(member, (delta))
168#define __sub_page_state(member,delta) __mod_page_state(member, 0UL - (delta))
169
170#define page_state(member) (*__page_state(offsetof(struct page_state, member)))
171
172#define state_zone_offset(zone, member) \
173({ \
163 unsigned offset; \ 174 unsigned offset; \
164 if (is_highmem(zone)) \ 175 if (is_highmem(zone)) \
165 offset = offsetof(struct page_state, member##_high); \ 176 offset = offsetof(struct page_state, member##_high); \
@@ -169,7 +180,17 @@ extern void __mod_page_state(unsigned long offset, unsigned long delta);
169 offset = offsetof(struct page_state, member##_dma32); \ 180 offset = offsetof(struct page_state, member##_dma32); \
170 else \ 181 else \
171 offset = offsetof(struct page_state, member##_dma); \ 182 offset = offsetof(struct page_state, member##_dma); \
172 __mod_page_state(offset, (delta)); \ 183 offset; \
184})
185
186#define __mod_page_state_zone(zone, member, delta) \
187 do { \
188 __mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
189 } while (0)
190
191#define mod_page_state_zone(zone, member, delta) \
192 do { \
193 mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
173 } while (0) 194 } while (0)
174 195
175/* 196/*