diff options
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r-- | include/linux/swap.h | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index de40f169a4e4..a3af95b2cb6d 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
8 | #include <linux/memcontrol.h> | 8 | #include <linux/memcontrol.h> |
9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
10 | #include <linux/node.h> | ||
10 | 11 | ||
11 | #include <asm/atomic.h> | 12 | #include <asm/atomic.h> |
12 | #include <asm/page.h> | 13 | #include <asm/page.h> |
@@ -171,8 +172,10 @@ extern unsigned int nr_free_pagecache_pages(void); | |||
171 | 172 | ||
172 | 173 | ||
173 | /* linux/mm/swap.c */ | 174 | /* linux/mm/swap.c */ |
174 | extern void lru_cache_add(struct page *); | 175 | extern void __lru_cache_add(struct page *, enum lru_list lru); |
175 | extern void lru_cache_add_active(struct page *); | 176 | extern void lru_cache_add_lru(struct page *, enum lru_list lru); |
177 | extern void lru_cache_add_active_or_unevictable(struct page *, | ||
178 | struct vm_area_struct *); | ||
176 | extern void activate_page(struct page *); | 179 | extern void activate_page(struct page *); |
177 | extern void mark_page_accessed(struct page *); | 180 | extern void mark_page_accessed(struct page *); |
178 | extern void lru_add_drain(void); | 181 | extern void lru_add_drain(void); |
@@ -180,12 +183,38 @@ extern int lru_add_drain_all(void); | |||
180 | extern void rotate_reclaimable_page(struct page *page); | 183 | extern void rotate_reclaimable_page(struct page *page); |
181 | extern void swap_setup(void); | 184 | extern void swap_setup(void); |
182 | 185 | ||
186 | extern void add_page_to_unevictable_list(struct page *page); | ||
187 | |||
188 | /** | ||
189 | * lru_cache_add: add a page to the page lists | ||
190 | * @page: the page to add | ||
191 | */ | ||
192 | static inline void lru_cache_add_anon(struct page *page) | ||
193 | { | ||
194 | __lru_cache_add(page, LRU_INACTIVE_ANON); | ||
195 | } | ||
196 | |||
197 | static inline void lru_cache_add_active_anon(struct page *page) | ||
198 | { | ||
199 | __lru_cache_add(page, LRU_ACTIVE_ANON); | ||
200 | } | ||
201 | |||
202 | static inline void lru_cache_add_file(struct page *page) | ||
203 | { | ||
204 | __lru_cache_add(page, LRU_INACTIVE_FILE); | ||
205 | } | ||
206 | |||
207 | static inline void lru_cache_add_active_file(struct page *page) | ||
208 | { | ||
209 | __lru_cache_add(page, LRU_ACTIVE_FILE); | ||
210 | } | ||
211 | |||
183 | /* linux/mm/vmscan.c */ | 212 | /* linux/mm/vmscan.c */ |
184 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | 213 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, |
185 | gfp_t gfp_mask); | 214 | gfp_t gfp_mask); |
186 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, | 215 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, |
187 | gfp_t gfp_mask); | 216 | gfp_t gfp_mask); |
188 | extern int __isolate_lru_page(struct page *page, int mode); | 217 | extern int __isolate_lru_page(struct page *page, int mode, int file); |
189 | extern unsigned long shrink_all_memory(unsigned long nr_pages); | 218 | extern unsigned long shrink_all_memory(unsigned long nr_pages); |
190 | extern int vm_swappiness; | 219 | extern int vm_swappiness; |
191 | extern int remove_mapping(struct address_space *mapping, struct page *page); | 220 | extern int remove_mapping(struct address_space *mapping, struct page *page); |
@@ -204,6 +233,34 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order) | |||
204 | } | 233 | } |
205 | #endif | 234 | #endif |
206 | 235 | ||
236 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
237 | extern int page_evictable(struct page *page, struct vm_area_struct *vma); | ||
238 | extern void scan_mapping_unevictable_pages(struct address_space *); | ||
239 | |||
240 | extern unsigned long scan_unevictable_pages; | ||
241 | extern int scan_unevictable_handler(struct ctl_table *, int, struct file *, | ||
242 | void __user *, size_t *, loff_t *); | ||
243 | extern int scan_unevictable_register_node(struct node *node); | ||
244 | extern void scan_unevictable_unregister_node(struct node *node); | ||
245 | #else | ||
246 | static inline int page_evictable(struct page *page, | ||
247 | struct vm_area_struct *vma) | ||
248 | { | ||
249 | return 1; | ||
250 | } | ||
251 | |||
252 | static inline void scan_mapping_unevictable_pages(struct address_space *mapping) | ||
253 | { | ||
254 | } | ||
255 | |||
256 | static inline int scan_unevictable_register_node(struct node *node) | ||
257 | { | ||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | static inline void scan_unevictable_unregister_node(struct node *node) { } | ||
262 | #endif | ||
263 | |||
207 | extern int kswapd_run(int nid); | 264 | extern int kswapd_run(int nid); |
208 | 265 | ||
209 | #ifdef CONFIG_MMU | 266 | #ifdef CONFIG_MMU |
@@ -251,6 +308,7 @@ extern sector_t swapdev_block(int, pgoff_t); | |||
251 | extern struct swap_info_struct *get_swap_info_struct(unsigned); | 308 | extern struct swap_info_struct *get_swap_info_struct(unsigned); |
252 | extern int can_share_swap_page(struct page *); | 309 | extern int can_share_swap_page(struct page *); |
253 | extern int remove_exclusive_swap_page(struct page *); | 310 | extern int remove_exclusive_swap_page(struct page *); |
311 | extern int remove_exclusive_swap_page_ref(struct page *); | ||
254 | struct backing_dev_info; | 312 | struct backing_dev_info; |
255 | 313 | ||
256 | /* linux/mm/thrash.c */ | 314 | /* linux/mm/thrash.c */ |
@@ -339,6 +397,11 @@ static inline int remove_exclusive_swap_page(struct page *p) | |||
339 | return 0; | 397 | return 0; |
340 | } | 398 | } |
341 | 399 | ||
400 | static inline int remove_exclusive_swap_page_ref(struct page *page) | ||
401 | { | ||
402 | return 0; | ||
403 | } | ||
404 | |||
342 | static inline swp_entry_t get_swap_page(void) | 405 | static inline swp_entry_t get_swap_page(void) |
343 | { | 406 | { |
344 | swp_entry_t entry; | 407 | swp_entry_t entry; |