diff options
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r-- | include/linux/swap.h | 101 |
1 files changed, 69 insertions, 32 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index aca9bfae208f..dc3f3aa0c83e 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -28,7 +28,14 @@ static inline int current_is_kswapd(void) | |||
28 | * the type/offset into the pte as 5/27 as well. | 28 | * the type/offset into the pte as 5/27 as well. |
29 | */ | 29 | */ |
30 | #define MAX_SWAPFILES_SHIFT 5 | 30 | #define MAX_SWAPFILES_SHIFT 5 |
31 | #ifndef CONFIG_MIGRATION | ||
31 | #define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) | 32 | #define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) |
33 | #else | ||
34 | /* Use last two entries for page migration swap entries */ | ||
35 | #define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT)-2) | ||
36 | #define SWP_MIGRATION_READ MAX_SWAPFILES | ||
37 | #define SWP_MIGRATION_WRITE (MAX_SWAPFILES + 1) | ||
38 | #endif | ||
32 | 39 | ||
33 | /* | 40 | /* |
34 | * Magic header for a swap area. The first part of the union is | 41 | * Magic header for a swap area. The first part of the union is |
@@ -48,12 +55,14 @@ union swap_header { | |||
48 | char magic[10]; /* SWAP-SPACE or SWAPSPACE2 */ | 55 | char magic[10]; /* SWAP-SPACE or SWAPSPACE2 */ |
49 | } magic; | 56 | } magic; |
50 | struct { | 57 | struct { |
51 | char bootbits[1024]; /* Space for disklabel etc. */ | 58 | char bootbits[1024]; /* Space for disklabel etc. */ |
52 | unsigned int version; | 59 | __u32 version; |
53 | unsigned int last_page; | 60 | __u32 last_page; |
54 | unsigned int nr_badpages; | 61 | __u32 nr_badpages; |
55 | unsigned int padding[125]; | 62 | unsigned char sws_uuid[16]; |
56 | unsigned int badpages[1]; | 63 | unsigned char sws_volume[16]; |
64 | __u32 padding[117]; | ||
65 | __u32 badpages[1]; | ||
57 | } info; | 66 | } info; |
58 | }; | 67 | }; |
59 | 68 | ||
@@ -176,20 +185,7 @@ extern unsigned long try_to_free_pages(struct zone **, gfp_t); | |||
176 | extern unsigned long shrink_all_memory(unsigned long nr_pages); | 185 | extern unsigned long shrink_all_memory(unsigned long nr_pages); |
177 | extern int vm_swappiness; | 186 | extern int vm_swappiness; |
178 | extern int remove_mapping(struct address_space *mapping, struct page *page); | 187 | extern int remove_mapping(struct address_space *mapping, struct page *page); |
179 | 188 | extern long vm_total_pages; | |
180 | /* possible outcome of pageout() */ | ||
181 | typedef enum { | ||
182 | /* failed to write page out, page is locked */ | ||
183 | PAGE_KEEP, | ||
184 | /* move page to the active list, page is locked */ | ||
185 | PAGE_ACTIVATE, | ||
186 | /* page has been sent to the disk successfully, page is unlocked */ | ||
187 | PAGE_SUCCESS, | ||
188 | /* page is clean and locked */ | ||
189 | PAGE_CLEAN, | ||
190 | } pageout_t; | ||
191 | |||
192 | extern pageout_t pageout(struct page *page, struct address_space *mapping); | ||
193 | 189 | ||
194 | #ifdef CONFIG_NUMA | 190 | #ifdef CONFIG_NUMA |
195 | extern int zone_reclaim_mode; | 191 | extern int zone_reclaim_mode; |
@@ -250,7 +246,6 @@ extern int remove_exclusive_swap_page(struct page *); | |||
250 | struct backing_dev_info; | 246 | struct backing_dev_info; |
251 | 247 | ||
252 | extern spinlock_t swap_lock; | 248 | extern spinlock_t swap_lock; |
253 | extern int remove_vma_swap(struct vm_area_struct *vma, struct page *page); | ||
254 | 249 | ||
255 | /* linux/mm/thrash.c */ | 250 | /* linux/mm/thrash.c */ |
256 | extern struct mm_struct * swap_token_mm; | 251 | extern struct mm_struct * swap_token_mm; |
@@ -288,18 +283,60 @@ static inline void disable_swap_token(void) | |||
288 | #define free_pages_and_swap_cache(pages, nr) \ | 283 | #define free_pages_and_swap_cache(pages, nr) \ |
289 | release_pages((pages), (nr), 0); | 284 | release_pages((pages), (nr), 0); |
290 | 285 | ||
291 | #define show_swap_cache_info() /*NOTHING*/ | 286 | static inline void show_swap_cache_info(void) |
292 | #define free_swap_and_cache(swp) /*NOTHING*/ | 287 | { |
293 | #define swap_duplicate(swp) /*NOTHING*/ | 288 | } |
294 | #define swap_free(swp) /*NOTHING*/ | 289 | |
295 | #define read_swap_cache_async(swp,vma,addr) NULL | 290 | static inline void free_swap_and_cache(swp_entry_t swp) |
296 | #define lookup_swap_cache(swp) NULL | 291 | { |
297 | #define valid_swaphandles(swp, off) 0 | 292 | } |
293 | |||
294 | static inline int swap_duplicate(swp_entry_t swp) | ||
295 | { | ||
296 | return 0; | ||
297 | } | ||
298 | |||
299 | static inline void swap_free(swp_entry_t swp) | ||
300 | { | ||
301 | } | ||
302 | |||
303 | static inline struct page *read_swap_cache_async(swp_entry_t swp, | ||
304 | struct vm_area_struct *vma, unsigned long addr) | ||
305 | { | ||
306 | return NULL; | ||
307 | } | ||
308 | |||
309 | static inline struct page *lookup_swap_cache(swp_entry_t swp) | ||
310 | { | ||
311 | return NULL; | ||
312 | } | ||
313 | |||
314 | static inline int valid_swaphandles(swp_entry_t entry, unsigned long *offset) | ||
315 | { | ||
316 | return 0; | ||
317 | } | ||
318 | |||
298 | #define can_share_swap_page(p) (page_mapcount(p) == 1) | 319 | #define can_share_swap_page(p) (page_mapcount(p) == 1) |
299 | #define move_to_swap_cache(p, swp) 1 | 320 | |
300 | #define move_from_swap_cache(p, i, m) 1 | 321 | static inline int move_to_swap_cache(struct page *page, swp_entry_t entry) |
301 | #define __delete_from_swap_cache(p) /*NOTHING*/ | 322 | { |
302 | #define delete_from_swap_cache(p) /*NOTHING*/ | 323 | return 1; |
324 | } | ||
325 | |||
326 | static inline int move_from_swap_cache(struct page *page, unsigned long index, | ||
327 | struct address_space *mapping) | ||
328 | { | ||
329 | return 1; | ||
330 | } | ||
331 | |||
332 | static inline void __delete_from_swap_cache(struct page *page) | ||
333 | { | ||
334 | } | ||
335 | |||
336 | static inline void delete_from_swap_cache(struct page *page) | ||
337 | { | ||
338 | } | ||
339 | |||
303 | #define swap_token_default_timeout 0 | 340 | #define swap_token_default_timeout 0 |
304 | 341 | ||
305 | static inline int remove_exclusive_swap_page(struct page *p) | 342 | static inline int remove_exclusive_swap_page(struct page *p) |