diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/page-flags.h | 43 |
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 { | |||
144 | extern void get_page_state(struct page_state *ret); | 144 | extern void get_page_state(struct page_state *ret); |
145 | extern void get_page_state_node(struct page_state *ret, int node); | 145 | extern void get_page_state_node(struct page_state *ret, int node); |
146 | extern void get_full_page_state(struct page_state *ret); | 146 | extern void get_full_page_state(struct page_state *ret); |
147 | extern unsigned long __read_page_state(unsigned long offset); | 147 | extern unsigned long read_page_state_offset(unsigned long offset); |
148 | extern void __mod_page_state(unsigned long offset, unsigned long delta); | 148 | extern void mod_page_state_offset(unsigned long offset, unsigned long delta); |
149 | extern 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 | /* |