diff options
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r-- | include/linux/swap.h | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index 7c15334f3ff..4ec90019c1a 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -34,15 +34,37 @@ static inline int current_is_kswapd(void) | |||
34 | * the type/offset into the pte as 5/27 as well. | 34 | * the type/offset into the pte as 5/27 as well. |
35 | */ | 35 | */ |
36 | #define MAX_SWAPFILES_SHIFT 5 | 36 | #define MAX_SWAPFILES_SHIFT 5 |
37 | #ifndef CONFIG_MIGRATION | 37 | |
38 | #define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) | 38 | /* |
39 | * Use some of the swap files numbers for other purposes. This | ||
40 | * is a convenient way to hook into the VM to trigger special | ||
41 | * actions on faults. | ||
42 | */ | ||
43 | |||
44 | /* | ||
45 | * NUMA node memory migration support | ||
46 | */ | ||
47 | #ifdef CONFIG_MIGRATION | ||
48 | #define SWP_MIGRATION_NUM 2 | ||
49 | #define SWP_MIGRATION_READ (MAX_SWAPFILES + SWP_HWPOISON_NUM) | ||
50 | #define SWP_MIGRATION_WRITE (MAX_SWAPFILES + SWP_HWPOISON_NUM + 1) | ||
51 | #else | ||
52 | #define SWP_MIGRATION_NUM 0 | ||
53 | #endif | ||
54 | |||
55 | /* | ||
56 | * Handling of hardware poisoned pages with memory corruption. | ||
57 | */ | ||
58 | #ifdef CONFIG_MEMORY_FAILURE | ||
59 | #define SWP_HWPOISON_NUM 1 | ||
60 | #define SWP_HWPOISON MAX_SWAPFILES | ||
39 | #else | 61 | #else |
40 | /* Use last two entries for page migration swap entries */ | 62 | #define SWP_HWPOISON_NUM 0 |
41 | #define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT)-2) | ||
42 | #define SWP_MIGRATION_READ MAX_SWAPFILES | ||
43 | #define SWP_MIGRATION_WRITE (MAX_SWAPFILES + 1) | ||
44 | #endif | 63 | #endif |
45 | 64 | ||
65 | #define MAX_SWAPFILES \ | ||
66 | ((1 << MAX_SWAPFILES_SHIFT) - SWP_MIGRATION_NUM - SWP_HWPOISON_NUM) | ||
67 | |||
46 | /* | 68 | /* |
47 | * Magic header for a swap area. The first part of the union is | 69 | * Magic header for a swap area. The first part of the union is |
48 | * what the swap magic looks like for the old (limited to 128MB) | 70 | * what the swap magic looks like for the old (limited to 128MB) |
@@ -217,6 +239,11 @@ extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | |||
217 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, | 239 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, |
218 | gfp_t gfp_mask, bool noswap, | 240 | gfp_t gfp_mask, bool noswap, |
219 | unsigned int swappiness); | 241 | unsigned int swappiness); |
242 | extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | ||
243 | gfp_t gfp_mask, bool noswap, | ||
244 | unsigned int swappiness, | ||
245 | struct zone *zone, | ||
246 | int nid); | ||
220 | extern int __isolate_lru_page(struct page *page, int mode, int file); | 247 | extern int __isolate_lru_page(struct page *page, int mode, int file); |
221 | extern unsigned long shrink_all_memory(unsigned long nr_pages); | 248 | extern unsigned long shrink_all_memory(unsigned long nr_pages); |
222 | extern int vm_swappiness; | 249 | extern int vm_swappiness; |
@@ -240,7 +267,7 @@ extern int page_evictable(struct page *page, struct vm_area_struct *vma); | |||
240 | extern void scan_mapping_unevictable_pages(struct address_space *); | 267 | extern void scan_mapping_unevictable_pages(struct address_space *); |
241 | 268 | ||
242 | extern unsigned long scan_unevictable_pages; | 269 | extern unsigned long scan_unevictable_pages; |
243 | extern int scan_unevictable_handler(struct ctl_table *, int, struct file *, | 270 | extern int scan_unevictable_handler(struct ctl_table *, int, |
244 | void __user *, size_t *, loff_t *); | 271 | void __user *, size_t *, loff_t *); |
245 | extern int scan_unevictable_register_node(struct node *node); | 272 | extern int scan_unevictable_register_node(struct node *node); |
246 | extern void scan_unevictable_unregister_node(struct node *node); | 273 | extern void scan_unevictable_unregister_node(struct node *node); |
@@ -419,10 +446,22 @@ static inline swp_entry_t get_swap_page(void) | |||
419 | } | 446 | } |
420 | 447 | ||
421 | /* linux/mm/thrash.c */ | 448 | /* linux/mm/thrash.c */ |
422 | #define put_swap_token(mm) do { } while (0) | 449 | static inline void put_swap_token(struct mm_struct *mm) |
423 | #define grab_swap_token(mm) do { } while (0) | 450 | { |
424 | #define has_swap_token(mm) 0 | 451 | } |
425 | #define disable_swap_token() do { } while (0) | 452 | |
453 | static inline void grab_swap_token(struct mm_struct *mm) | ||
454 | { | ||
455 | } | ||
456 | |||
457 | static inline int has_swap_token(struct mm_struct *mm) | ||
458 | { | ||
459 | return 0; | ||
460 | } | ||
461 | |||
462 | static inline void disable_swap_token(void) | ||
463 | { | ||
464 | } | ||
426 | 465 | ||
427 | static inline void | 466 | static inline void |
428 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) | 467 | mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) |