diff options
Diffstat (limited to 'include/linux/page-flags.h')
-rw-r--r-- | include/linux/page-flags.h | 91 |
1 files changed, 66 insertions, 25 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 343083fec258..d52999c43336 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -79,13 +79,23 @@ | |||
79 | /* | 79 | /* |
80 | * Global page accounting. One instance per CPU. Only unsigned longs are | 80 | * Global page accounting. One instance per CPU. Only unsigned longs are |
81 | * allowed. | 81 | * allowed. |
82 | * | ||
83 | * - Fields can be modified with xxx_page_state and xxx_page_state_zone at | ||
84 | * any time safely (which protects the instance from modification by | ||
85 | * interrupt. | ||
86 | * - The __xxx_page_state variants can be used safely when interrupts are | ||
87 | * disabled. | ||
88 | * - The __xxx_page_state variants can be used if the field is only | ||
89 | * modified from process context, or only modified from interrupt context. | ||
90 | * In this case, the field should be commented here. | ||
82 | */ | 91 | */ |
83 | struct page_state { | 92 | struct page_state { |
84 | unsigned long nr_dirty; /* Dirty writeable pages */ | 93 | unsigned long nr_dirty; /* Dirty writeable pages */ |
85 | unsigned long nr_writeback; /* Pages under writeback */ | 94 | unsigned long nr_writeback; /* Pages under writeback */ |
86 | unsigned long nr_unstable; /* NFS unstable pages */ | 95 | unsigned long nr_unstable; /* NFS unstable pages */ |
87 | unsigned long nr_page_table_pages;/* Pages used for pagetables */ | 96 | unsigned long nr_page_table_pages;/* Pages used for pagetables */ |
88 | unsigned long nr_mapped; /* mapped into pagetables */ | 97 | unsigned long nr_mapped; /* mapped into pagetables. |
98 | * only modified from process context */ | ||
89 | unsigned long nr_slab; /* In slab */ | 99 | unsigned long nr_slab; /* In slab */ |
90 | #define GET_PAGE_STATE_LAST nr_slab | 100 | #define GET_PAGE_STATE_LAST nr_slab |
91 | 101 | ||
@@ -97,32 +107,40 @@ struct page_state { | |||
97 | unsigned long pgpgout; /* Disk writes */ | 107 | unsigned long pgpgout; /* Disk writes */ |
98 | unsigned long pswpin; /* swap reads */ | 108 | unsigned long pswpin; /* swap reads */ |
99 | unsigned long pswpout; /* swap writes */ | 109 | unsigned long pswpout; /* swap writes */ |
100 | unsigned long pgalloc_high; /* page allocations */ | ||
101 | 110 | ||
111 | unsigned long pgalloc_high; /* page allocations */ | ||
102 | unsigned long pgalloc_normal; | 112 | unsigned long pgalloc_normal; |
113 | unsigned long pgalloc_dma32; | ||
103 | unsigned long pgalloc_dma; | 114 | unsigned long pgalloc_dma; |
115 | |||
104 | unsigned long pgfree; /* page freeings */ | 116 | unsigned long pgfree; /* page freeings */ |
105 | unsigned long pgactivate; /* pages moved inactive->active */ | 117 | unsigned long pgactivate; /* pages moved inactive->active */ |
106 | unsigned long pgdeactivate; /* pages moved active->inactive */ | 118 | unsigned long pgdeactivate; /* pages moved active->inactive */ |
107 | 119 | ||
108 | unsigned long pgfault; /* faults (major+minor) */ | 120 | unsigned long pgfault; /* faults (major+minor) */ |
109 | unsigned long pgmajfault; /* faults (major only) */ | 121 | unsigned long pgmajfault; /* faults (major only) */ |
122 | |||
110 | unsigned long pgrefill_high; /* inspected in refill_inactive_zone */ | 123 | unsigned long pgrefill_high; /* inspected in refill_inactive_zone */ |
111 | unsigned long pgrefill_normal; | 124 | unsigned long pgrefill_normal; |
125 | unsigned long pgrefill_dma32; | ||
112 | unsigned long pgrefill_dma; | 126 | unsigned long pgrefill_dma; |
113 | 127 | ||
114 | unsigned long pgsteal_high; /* total highmem pages reclaimed */ | 128 | unsigned long pgsteal_high; /* total highmem pages reclaimed */ |
115 | unsigned long pgsteal_normal; | 129 | unsigned long pgsteal_normal; |
130 | unsigned long pgsteal_dma32; | ||
116 | unsigned long pgsteal_dma; | 131 | unsigned long pgsteal_dma; |
132 | |||
117 | unsigned long pgscan_kswapd_high;/* total highmem pages scanned */ | 133 | unsigned long pgscan_kswapd_high;/* total highmem pages scanned */ |
118 | unsigned long pgscan_kswapd_normal; | 134 | unsigned long pgscan_kswapd_normal; |
119 | 135 | unsigned long pgscan_kswapd_dma32; | |
120 | unsigned long pgscan_kswapd_dma; | 136 | unsigned long pgscan_kswapd_dma; |
137 | |||
121 | unsigned long pgscan_direct_high;/* total highmem pages scanned */ | 138 | unsigned long pgscan_direct_high;/* total highmem pages scanned */ |
122 | unsigned long pgscan_direct_normal; | 139 | unsigned long pgscan_direct_normal; |
140 | unsigned long pgscan_direct_dma32; | ||
123 | unsigned long pgscan_direct_dma; | 141 | unsigned long pgscan_direct_dma; |
124 | unsigned long pginodesteal; /* pages reclaimed via inode freeing */ | ||
125 | 142 | ||
143 | unsigned long pginodesteal; /* pages reclaimed via inode freeing */ | ||
126 | unsigned long slabs_scanned; /* slab objects scanned */ | 144 | unsigned long slabs_scanned; /* slab objects scanned */ |
127 | unsigned long kswapd_steal; /* pages reclaimed by kswapd */ | 145 | unsigned long kswapd_steal; /* pages reclaimed by kswapd */ |
128 | unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */ | 146 | unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */ |
@@ -136,31 +154,54 @@ struct page_state { | |||
136 | extern void get_page_state(struct page_state *ret); | 154 | extern void get_page_state(struct page_state *ret); |
137 | extern void get_page_state_node(struct page_state *ret, int node); | 155 | extern void get_page_state_node(struct page_state *ret, int node); |
138 | extern void get_full_page_state(struct page_state *ret); | 156 | extern void get_full_page_state(struct page_state *ret); |
139 | extern unsigned long __read_page_state(unsigned long offset); | 157 | extern unsigned long read_page_state_offset(unsigned long offset); |
140 | extern void __mod_page_state(unsigned long offset, unsigned long delta); | 158 | extern void mod_page_state_offset(unsigned long offset, unsigned long delta); |
159 | extern void __mod_page_state_offset(unsigned long offset, unsigned long delta); | ||
141 | 160 | ||
142 | #define read_page_state(member) \ | 161 | #define read_page_state(member) \ |
143 | __read_page_state(offsetof(struct page_state, member)) | 162 | read_page_state_offset(offsetof(struct page_state, member)) |
144 | 163 | ||
145 | #define mod_page_state(member, delta) \ | 164 | #define mod_page_state(member, delta) \ |
146 | __mod_page_state(offsetof(struct page_state, member), (delta)) | 165 | mod_page_state_offset(offsetof(struct page_state, member), (delta)) |
147 | 166 | ||
148 | #define inc_page_state(member) mod_page_state(member, 1UL) | 167 | #define __mod_page_state(member, delta) \ |
149 | #define dec_page_state(member) mod_page_state(member, 0UL - 1) | 168 | __mod_page_state_offset(offsetof(struct page_state, member), (delta)) |
150 | #define add_page_state(member,delta) mod_page_state(member, (delta)) | 169 | |
151 | #define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta)) | 170 | #define inc_page_state(member) mod_page_state(member, 1UL) |
152 | 171 | #define dec_page_state(member) mod_page_state(member, 0UL - 1) | |
153 | #define mod_page_state_zone(zone, member, delta) \ | 172 | #define add_page_state(member,delta) mod_page_state(member, (delta)) |
154 | do { \ | 173 | #define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta)) |
155 | unsigned offset; \ | 174 | |
156 | if (is_highmem(zone)) \ | 175 | #define __inc_page_state(member) __mod_page_state(member, 1UL) |
157 | offset = offsetof(struct page_state, member##_high); \ | 176 | #define __dec_page_state(member) __mod_page_state(member, 0UL - 1) |
158 | else if (is_normal(zone)) \ | 177 | #define __add_page_state(member,delta) __mod_page_state(member, (delta)) |
159 | offset = offsetof(struct page_state, member##_normal); \ | 178 | #define __sub_page_state(member,delta) __mod_page_state(member, 0UL - (delta)) |
160 | else \ | 179 | |
161 | offset = offsetof(struct page_state, member##_dma); \ | 180 | #define page_state(member) (*__page_state(offsetof(struct page_state, member))) |
162 | __mod_page_state(offset, (delta)); \ | 181 | |
163 | } while (0) | 182 | #define state_zone_offset(zone, member) \ |
183 | ({ \ | ||
184 | unsigned offset; \ | ||
185 | if (is_highmem(zone)) \ | ||
186 | offset = offsetof(struct page_state, member##_high); \ | ||
187 | else if (is_normal(zone)) \ | ||
188 | offset = offsetof(struct page_state, member##_normal); \ | ||
189 | else if (is_dma32(zone)) \ | ||
190 | offset = offsetof(struct page_state, member##_dma32); \ | ||
191 | else \ | ||
192 | offset = offsetof(struct page_state, member##_dma); \ | ||
193 | offset; \ | ||
194 | }) | ||
195 | |||
196 | #define __mod_page_state_zone(zone, member, delta) \ | ||
197 | do { \ | ||
198 | __mod_page_state_offset(state_zone_offset(zone, member), (delta)); \ | ||
199 | } while (0) | ||
200 | |||
201 | #define mod_page_state_zone(zone, member, delta) \ | ||
202 | do { \ | ||
203 | mod_page_state_offset(state_zone_offset(zone, member), (delta)); \ | ||
204 | } while (0) | ||
164 | 205 | ||
165 | /* | 206 | /* |
166 | * Manipulation of page state flags | 207 | * Manipulation of page state flags |