diff options
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r-- | include/linux/swap.h | 65 |
1 files changed, 26 insertions, 39 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index d476aad3ff57..7c15334f3ff2 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -129,9 +129,10 @@ enum { | |||
129 | 129 | ||
130 | #define SWAP_CLUSTER_MAX 32 | 130 | #define SWAP_CLUSTER_MAX 32 |
131 | 131 | ||
132 | #define SWAP_MAP_MAX 0x7fff | 132 | #define SWAP_MAP_MAX 0x7ffe |
133 | #define SWAP_MAP_BAD 0x8000 | 133 | #define SWAP_MAP_BAD 0x7fff |
134 | 134 | #define SWAP_HAS_CACHE 0x8000 /* There is a swap cache of entry. */ | |
135 | #define SWAP_COUNT_MASK (~SWAP_HAS_CACHE) | ||
135 | /* | 136 | /* |
136 | * The in-memory structure used to track swap areas. | 137 | * The in-memory structure used to track swap areas. |
137 | */ | 138 | */ |
@@ -235,7 +236,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order) | |||
235 | } | 236 | } |
236 | #endif | 237 | #endif |
237 | 238 | ||
238 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
239 | extern int page_evictable(struct page *page, struct vm_area_struct *vma); | 239 | extern int page_evictable(struct page *page, struct vm_area_struct *vma); |
240 | extern void scan_mapping_unevictable_pages(struct address_space *); | 240 | extern void scan_mapping_unevictable_pages(struct address_space *); |
241 | 241 | ||
@@ -244,24 +244,6 @@ extern int scan_unevictable_handler(struct ctl_table *, int, struct file *, | |||
244 | void __user *, size_t *, loff_t *); | 244 | void __user *, size_t *, loff_t *); |
245 | extern int scan_unevictable_register_node(struct node *node); | 245 | extern int scan_unevictable_register_node(struct node *node); |
246 | extern void scan_unevictable_unregister_node(struct node *node); | 246 | extern void scan_unevictable_unregister_node(struct node *node); |
247 | #else | ||
248 | static inline int page_evictable(struct page *page, | ||
249 | struct vm_area_struct *vma) | ||
250 | { | ||
251 | return 1; | ||
252 | } | ||
253 | |||
254 | static inline void scan_mapping_unevictable_pages(struct address_space *mapping) | ||
255 | { | ||
256 | } | ||
257 | |||
258 | static inline int scan_unevictable_register_node(struct node *node) | ||
259 | { | ||
260 | return 0; | ||
261 | } | ||
262 | |||
263 | static inline void scan_unevictable_unregister_node(struct node *node) { } | ||
264 | #endif | ||
265 | 247 | ||
266 | extern int kswapd_run(int nid); | 248 | extern int kswapd_run(int nid); |
267 | 249 | ||
@@ -274,7 +256,7 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *); | |||
274 | 256 | ||
275 | #ifdef CONFIG_SWAP | 257 | #ifdef CONFIG_SWAP |
276 | /* linux/mm/page_io.c */ | 258 | /* linux/mm/page_io.c */ |
277 | extern int swap_readpage(struct file *, struct page *); | 259 | extern int swap_readpage(struct page *); |
278 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); | 260 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); |
279 | extern void end_swap_bio_read(struct bio *bio, int err); | 261 | extern void end_swap_bio_read(struct bio *bio, int err); |
280 | 262 | ||
@@ -300,9 +282,11 @@ extern long total_swap_pages; | |||
300 | extern void si_swapinfo(struct sysinfo *); | 282 | extern void si_swapinfo(struct sysinfo *); |
301 | extern swp_entry_t get_swap_page(void); | 283 | extern swp_entry_t get_swap_page(void); |
302 | extern swp_entry_t get_swap_page_of_type(int); | 284 | extern swp_entry_t get_swap_page_of_type(int); |
303 | extern int swap_duplicate(swp_entry_t); | 285 | extern void swap_duplicate(swp_entry_t); |
286 | extern int swapcache_prepare(swp_entry_t); | ||
304 | extern int valid_swaphandles(swp_entry_t, unsigned long *); | 287 | extern int valid_swaphandles(swp_entry_t, unsigned long *); |
305 | extern void swap_free(swp_entry_t); | 288 | extern void swap_free(swp_entry_t); |
289 | extern void swapcache_free(swp_entry_t, struct page *page); | ||
306 | extern int free_swap_and_cache(swp_entry_t); | 290 | extern int free_swap_and_cache(swp_entry_t); |
307 | extern int swap_type_of(dev_t, sector_t, struct block_device **); | 291 | extern int swap_type_of(dev_t, sector_t, struct block_device **); |
308 | extern unsigned int count_swap_pages(int, int); | 292 | extern unsigned int count_swap_pages(int, int); |
@@ -314,8 +298,8 @@ extern int try_to_free_swap(struct page *); | |||
314 | struct backing_dev_info; | 298 | struct backing_dev_info; |
315 | 299 | ||
316 | /* linux/mm/thrash.c */ | 300 | /* linux/mm/thrash.c */ |
317 | extern struct mm_struct * swap_token_mm; | 301 | extern struct mm_struct *swap_token_mm; |
318 | extern void grab_swap_token(void); | 302 | extern void grab_swap_token(struct mm_struct *); |
319 | extern void __put_swap_token(struct mm_struct *); | 303 | extern void __put_swap_token(struct mm_struct *); |
320 | 304 | ||
321 | static inline int has_swap_token(struct mm_struct *mm) | 305 | static inline int has_swap_token(struct mm_struct *mm) |
@@ -335,10 +319,11 @@ static inline void disable_swap_token(void) | |||
335 | } | 319 | } |
336 | 320 | ||
337 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 321 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
338 | extern void mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent); | 322 | extern void |
323 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout); | ||
339 | #else | 324 | #else |
340 | static inline void | 325 | static inline void |
341 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) | 326 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout) |
342 | { | 327 | { |
343 | } | 328 | } |
344 | #endif | 329 | #endif |
@@ -370,12 +355,20 @@ static inline void show_swap_cache_info(void) | |||
370 | } | 355 | } |
371 | 356 | ||
372 | #define free_swap_and_cache(swp) is_migration_entry(swp) | 357 | #define free_swap_and_cache(swp) is_migration_entry(swp) |
373 | #define swap_duplicate(swp) is_migration_entry(swp) | 358 | #define swapcache_prepare(swp) is_migration_entry(swp) |
359 | |||
360 | static inline void swap_duplicate(swp_entry_t swp) | ||
361 | { | ||
362 | } | ||
374 | 363 | ||
375 | static inline void swap_free(swp_entry_t swp) | 364 | static inline void swap_free(swp_entry_t swp) |
376 | { | 365 | { |
377 | } | 366 | } |
378 | 367 | ||
368 | static inline void swapcache_free(swp_entry_t swp, struct page *page) | ||
369 | { | ||
370 | } | ||
371 | |||
379 | static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, | 372 | static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, |
380 | struct vm_area_struct *vma, unsigned long addr) | 373 | struct vm_area_struct *vma, unsigned long addr) |
381 | { | 374 | { |
@@ -426,16 +419,10 @@ static inline swp_entry_t get_swap_page(void) | |||
426 | } | 419 | } |
427 | 420 | ||
428 | /* linux/mm/thrash.c */ | 421 | /* linux/mm/thrash.c */ |
429 | #define put_swap_token(x) do { } while(0) | 422 | #define put_swap_token(mm) do { } while (0) |
430 | #define grab_swap_token() do { } while(0) | 423 | #define grab_swap_token(mm) do { } while (0) |
431 | #define has_swap_token(x) 0 | 424 | #define has_swap_token(mm) 0 |
432 | #define disable_swap_token() do { } while(0) | 425 | #define disable_swap_token() do { } while (0) |
433 | |||
434 | static inline int mem_cgroup_cache_charge_swapin(struct page *page, | ||
435 | struct mm_struct *mm, gfp_t mask, bool locked) | ||
436 | { | ||
437 | return 0; | ||
438 | } | ||
439 | 426 | ||
440 | static inline void | 427 | static inline void |
441 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) | 428 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) |