diff options
Diffstat (limited to 'include/linux/page-flags.h')
-rw-r--r-- | include/linux/page-flags.h | 149 |
1 files changed, 12 insertions, 137 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 0c076d58c676..5748642e9f36 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -5,12 +5,8 @@ | |||
5 | #ifndef PAGE_FLAGS_H | 5 | #ifndef PAGE_FLAGS_H |
6 | #define PAGE_FLAGS_H | 6 | #define PAGE_FLAGS_H |
7 | 7 | ||
8 | #include <linux/percpu.h> | ||
9 | #include <linux/cache.h> | ||
10 | #include <linux/types.h> | 8 | #include <linux/types.h> |
11 | 9 | ||
12 | #include <asm/pgtable.h> | ||
13 | |||
14 | /* | 10 | /* |
15 | * Various page->flags bits: | 11 | * Various page->flags bits: |
16 | * | 12 | * |
@@ -103,134 +99,6 @@ | |||
103 | #endif | 99 | #endif |
104 | 100 | ||
105 | /* | 101 | /* |
106 | * Global page accounting. One instance per CPU. Only unsigned longs are | ||
107 | * allowed. | ||
108 | * | ||
109 | * - Fields can be modified with xxx_page_state and xxx_page_state_zone at | ||
110 | * any time safely (which protects the instance from modification by | ||
111 | * interrupt. | ||
112 | * - The __xxx_page_state variants can be used safely when interrupts are | ||
113 | * disabled. | ||
114 | * - The __xxx_page_state variants can be used if the field is only | ||
115 | * modified from process context and protected from preemption, or only | ||
116 | * modified from interrupt context. In this case, the field should be | ||
117 | * commented here. | ||
118 | */ | ||
119 | struct page_state { | ||
120 | unsigned long nr_dirty; /* Dirty writeable pages */ | ||
121 | unsigned long nr_writeback; /* Pages under writeback */ | ||
122 | unsigned long nr_unstable; /* NFS unstable pages */ | ||
123 | unsigned long nr_page_table_pages;/* Pages used for pagetables */ | ||
124 | unsigned long nr_mapped; /* mapped into pagetables. | ||
125 | * only modified from process context */ | ||
126 | unsigned long nr_slab; /* In slab */ | ||
127 | #define GET_PAGE_STATE_LAST nr_slab | ||
128 | |||
129 | /* | ||
130 | * The below are zeroed by get_page_state(). Use get_full_page_state() | ||
131 | * to add up all these. | ||
132 | */ | ||
133 | unsigned long pgpgin; /* Disk reads */ | ||
134 | unsigned long pgpgout; /* Disk writes */ | ||
135 | unsigned long pswpin; /* swap reads */ | ||
136 | unsigned long pswpout; /* swap writes */ | ||
137 | |||
138 | unsigned long pgalloc_high; /* page allocations */ | ||
139 | unsigned long pgalloc_normal; | ||
140 | unsigned long pgalloc_dma32; | ||
141 | unsigned long pgalloc_dma; | ||
142 | |||
143 | unsigned long pgfree; /* page freeings */ | ||
144 | unsigned long pgactivate; /* pages moved inactive->active */ | ||
145 | unsigned long pgdeactivate; /* pages moved active->inactive */ | ||
146 | |||
147 | unsigned long pgfault; /* faults (major+minor) */ | ||
148 | unsigned long pgmajfault; /* faults (major only) */ | ||
149 | |||
150 | unsigned long pgrefill_high; /* inspected in refill_inactive_zone */ | ||
151 | unsigned long pgrefill_normal; | ||
152 | unsigned long pgrefill_dma32; | ||
153 | unsigned long pgrefill_dma; | ||
154 | |||
155 | unsigned long pgsteal_high; /* total highmem pages reclaimed */ | ||
156 | unsigned long pgsteal_normal; | ||
157 | unsigned long pgsteal_dma32; | ||
158 | unsigned long pgsteal_dma; | ||
159 | |||
160 | unsigned long pgscan_kswapd_high;/* total highmem pages scanned */ | ||
161 | unsigned long pgscan_kswapd_normal; | ||
162 | unsigned long pgscan_kswapd_dma32; | ||
163 | unsigned long pgscan_kswapd_dma; | ||
164 | |||
165 | unsigned long pgscan_direct_high;/* total highmem pages scanned */ | ||
166 | unsigned long pgscan_direct_normal; | ||
167 | unsigned long pgscan_direct_dma32; | ||
168 | unsigned long pgscan_direct_dma; | ||
169 | |||
170 | unsigned long pginodesteal; /* pages reclaimed via inode freeing */ | ||
171 | unsigned long slabs_scanned; /* slab objects scanned */ | ||
172 | unsigned long kswapd_steal; /* pages reclaimed by kswapd */ | ||
173 | unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */ | ||
174 | unsigned long pageoutrun; /* kswapd's calls to page reclaim */ | ||
175 | unsigned long allocstall; /* direct reclaim calls */ | ||
176 | |||
177 | unsigned long pgrotated; /* pages rotated to tail of the LRU */ | ||
178 | unsigned long nr_bounce; /* pages for bounce buffers */ | ||
179 | }; | ||
180 | |||
181 | extern void get_page_state(struct page_state *ret); | ||
182 | extern void get_page_state_node(struct page_state *ret, int node); | ||
183 | extern void get_full_page_state(struct page_state *ret); | ||
184 | extern unsigned long read_page_state_offset(unsigned long offset); | ||
185 | extern void mod_page_state_offset(unsigned long offset, unsigned long delta); | ||
186 | extern void __mod_page_state_offset(unsigned long offset, unsigned long delta); | ||
187 | |||
188 | #define read_page_state(member) \ | ||
189 | read_page_state_offset(offsetof(struct page_state, member)) | ||
190 | |||
191 | #define mod_page_state(member, delta) \ | ||
192 | mod_page_state_offset(offsetof(struct page_state, member), (delta)) | ||
193 | |||
194 | #define __mod_page_state(member, delta) \ | ||
195 | __mod_page_state_offset(offsetof(struct page_state, member), (delta)) | ||
196 | |||
197 | #define inc_page_state(member) mod_page_state(member, 1UL) | ||
198 | #define dec_page_state(member) mod_page_state(member, 0UL - 1) | ||
199 | #define add_page_state(member,delta) mod_page_state(member, (delta)) | ||
200 | #define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta)) | ||
201 | |||
202 | #define __inc_page_state(member) __mod_page_state(member, 1UL) | ||
203 | #define __dec_page_state(member) __mod_page_state(member, 0UL - 1) | ||
204 | #define __add_page_state(member,delta) __mod_page_state(member, (delta)) | ||
205 | #define __sub_page_state(member,delta) __mod_page_state(member, 0UL - (delta)) | ||
206 | |||
207 | #define page_state(member) (*__page_state(offsetof(struct page_state, member))) | ||
208 | |||
209 | #define state_zone_offset(zone, member) \ | ||
210 | ({ \ | ||
211 | unsigned offset; \ | ||
212 | if (is_highmem(zone)) \ | ||
213 | offset = offsetof(struct page_state, member##_high); \ | ||
214 | else if (is_normal(zone)) \ | ||
215 | offset = offsetof(struct page_state, member##_normal); \ | ||
216 | else if (is_dma32(zone)) \ | ||
217 | offset = offsetof(struct page_state, member##_dma32); \ | ||
218 | else \ | ||
219 | offset = offsetof(struct page_state, member##_dma); \ | ||
220 | offset; \ | ||
221 | }) | ||
222 | |||
223 | #define __mod_page_state_zone(zone, member, delta) \ | ||
224 | do { \ | ||
225 | __mod_page_state_offset(state_zone_offset(zone, member), (delta)); \ | ||
226 | } while (0) | ||
227 | |||
228 | #define mod_page_state_zone(zone, member, delta) \ | ||
229 | do { \ | ||
230 | mod_page_state_offset(state_zone_offset(zone, member), (delta)); \ | ||
231 | } while (0) | ||
232 | |||
233 | /* | ||
234 | * Manipulation of page state flags | 102 | * Manipulation of page state flags |
235 | */ | 103 | */ |
236 | #define PageLocked(page) \ | 104 | #define PageLocked(page) \ |
@@ -254,7 +122,14 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta); | |||
254 | #define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags) | 122 | #define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags) |
255 | 123 | ||
256 | #define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags) | 124 | #define PageUptodate(page) test_bit(PG_uptodate, &(page)->flags) |
257 | #ifndef SetPageUptodate | 125 | #ifdef CONFIG_S390 |
126 | #define SetPageUptodate(_page) \ | ||
127 | do { \ | ||
128 | struct page *__page = (_page); \ | ||
129 | if (!test_and_set_bit(PG_uptodate, &__page->flags)) \ | ||
130 | page_test_and_clear_dirty(_page); \ | ||
131 | } while (0) | ||
132 | #else | ||
258 | #define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) | 133 | #define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) |
259 | #endif | 134 | #endif |
260 | #define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) | 135 | #define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) |
@@ -306,7 +181,7 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta); | |||
306 | do { \ | 181 | do { \ |
307 | if (!test_and_set_bit(PG_writeback, \ | 182 | if (!test_and_set_bit(PG_writeback, \ |
308 | &(page)->flags)) \ | 183 | &(page)->flags)) \ |
309 | inc_page_state(nr_writeback); \ | 184 | inc_zone_page_state(page, NR_WRITEBACK); \ |
310 | } while (0) | 185 | } while (0) |
311 | #define TestSetPageWriteback(page) \ | 186 | #define TestSetPageWriteback(page) \ |
312 | ({ \ | 187 | ({ \ |
@@ -314,14 +189,14 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta); | |||
314 | ret = test_and_set_bit(PG_writeback, \ | 189 | ret = test_and_set_bit(PG_writeback, \ |
315 | &(page)->flags); \ | 190 | &(page)->flags); \ |
316 | if (!ret) \ | 191 | if (!ret) \ |
317 | inc_page_state(nr_writeback); \ | 192 | inc_zone_page_state(page, NR_WRITEBACK); \ |
318 | ret; \ | 193 | ret; \ |
319 | }) | 194 | }) |
320 | #define ClearPageWriteback(page) \ | 195 | #define ClearPageWriteback(page) \ |
321 | do { \ | 196 | do { \ |
322 | if (test_and_clear_bit(PG_writeback, \ | 197 | if (test_and_clear_bit(PG_writeback, \ |
323 | &(page)->flags)) \ | 198 | &(page)->flags)) \ |
324 | dec_page_state(nr_writeback); \ | 199 | dec_zone_page_state(page, NR_WRITEBACK); \ |
325 | } while (0) | 200 | } while (0) |
326 | #define TestClearPageWriteback(page) \ | 201 | #define TestClearPageWriteback(page) \ |
327 | ({ \ | 202 | ({ \ |
@@ -329,7 +204,7 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta); | |||
329 | ret = test_and_clear_bit(PG_writeback, \ | 204 | ret = test_and_clear_bit(PG_writeback, \ |
330 | &(page)->flags); \ | 205 | &(page)->flags); \ |
331 | if (ret) \ | 206 | if (ret) \ |
332 | dec_page_state(nr_writeback); \ | 207 | dec_zone_page_state(page, NR_WRITEBACK); \ |
333 | ret; \ | 208 | ret; \ |
334 | }) | 209 | }) |
335 | 210 | ||