diff options
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r-- | include/linux/swap.h | 105 |
1 files changed, 72 insertions, 33 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index aca9bfae208..5e59184c909 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,24 +185,11 @@ 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; |
196 | extern int zone_reclaim_interval; | 192 | extern int sysctl_min_unmapped_ratio; |
197 | extern int zone_reclaim(struct zone *, gfp_t, unsigned int); | 193 | extern int zone_reclaim(struct zone *, gfp_t, unsigned int); |
198 | #else | 194 | #else |
199 | #define zone_reclaim_mode 0 | 195 | #define zone_reclaim_mode 0 |
@@ -203,6 +199,8 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order) | |||
203 | } | 199 | } |
204 | #endif | 200 | #endif |
205 | 201 | ||
202 | extern int kswapd_run(int nid); | ||
203 | |||
206 | #ifdef CONFIG_MMU | 204 | #ifdef CONFIG_MMU |
207 | /* linux/mm/shmem.c */ | 205 | /* linux/mm/shmem.c */ |
208 | extern int shmem_unuse(swp_entry_t entry, struct page *page); | 206 | extern int shmem_unuse(swp_entry_t entry, struct page *page); |
@@ -250,7 +248,6 @@ extern int remove_exclusive_swap_page(struct page *); | |||
250 | struct backing_dev_info; | 248 | struct backing_dev_info; |
251 | 249 | ||
252 | extern spinlock_t swap_lock; | 250 | extern spinlock_t swap_lock; |
253 | extern int remove_vma_swap(struct vm_area_struct *vma, struct page *page); | ||
254 | 251 | ||
255 | /* linux/mm/thrash.c */ | 252 | /* linux/mm/thrash.c */ |
256 | extern struct mm_struct * swap_token_mm; | 253 | extern struct mm_struct * swap_token_mm; |
@@ -288,18 +285,60 @@ static inline void disable_swap_token(void) | |||
288 | #define free_pages_and_swap_cache(pages, nr) \ | 285 | #define free_pages_and_swap_cache(pages, nr) \ |
289 | release_pages((pages), (nr), 0); | 286 | release_pages((pages), (nr), 0); |
290 | 287 | ||
291 | #define show_swap_cache_info() /*NOTHING*/ | 288 | static inline void show_swap_cache_info(void) |
292 | #define free_swap_and_cache(swp) /*NOTHING*/ | 289 | { |
293 | #define swap_duplicate(swp) /*NOTHING*/ | 290 | } |
294 | #define swap_free(swp) /*NOTHING*/ | 291 | |
295 | #define read_swap_cache_async(swp,vma,addr) NULL | 292 | static inline void free_swap_and_cache(swp_entry_t swp) |
296 | #define lookup_swap_cache(swp) NULL | 293 | { |
297 | #define valid_swaphandles(swp, off) 0 | 294 | } |
295 | |||
296 | static inline int swap_duplicate(swp_entry_t swp) | ||
297 | { | ||
298 | return 0; | ||
299 | } | ||
300 | |||
301 | static inline void swap_free(swp_entry_t swp) | ||
302 | { | ||
303 | } | ||
304 | |||
305 | static inline struct page *read_swap_cache_async(swp_entry_t swp, | ||
306 | struct vm_area_struct *vma, unsigned long addr) | ||
307 | { | ||
308 | return NULL; | ||
309 | } | ||
310 | |||
311 | static inline struct page *lookup_swap_cache(swp_entry_t swp) | ||
312 | { | ||
313 | return NULL; | ||
314 | } | ||
315 | |||
316 | static inline int valid_swaphandles(swp_entry_t entry, unsigned long *offset) | ||
317 | { | ||
318 | return 0; | ||
319 | } | ||
320 | |||
298 | #define can_share_swap_page(p) (page_mapcount(p) == 1) | 321 | #define can_share_swap_page(p) (page_mapcount(p) == 1) |
299 | #define move_to_swap_cache(p, swp) 1 | 322 | |
300 | #define move_from_swap_cache(p, i, m) 1 | 323 | static inline int move_to_swap_cache(struct page *page, swp_entry_t entry) |
301 | #define __delete_from_swap_cache(p) /*NOTHING*/ | 324 | { |
302 | #define delete_from_swap_cache(p) /*NOTHING*/ | 325 | return 1; |
326 | } | ||
327 | |||
328 | static inline int move_from_swap_cache(struct page *page, unsigned long index, | ||
329 | struct address_space *mapping) | ||
330 | { | ||
331 | return 1; | ||
332 | } | ||
333 | |||
334 | static inline void __delete_from_swap_cache(struct page *page) | ||
335 | { | ||
336 | } | ||
337 | |||
338 | static inline void delete_from_swap_cache(struct page *page) | ||
339 | { | ||
340 | } | ||
341 | |||
303 | #define swap_token_default_timeout 0 | 342 | #define swap_token_default_timeout 0 |
304 | 343 | ||
305 | static inline int remove_exclusive_swap_page(struct page *p) | 344 | static inline int remove_exclusive_swap_page(struct page *p) |