diff options
-rw-r--r-- | include/linux/swap.h | 2 | ||||
-rw-r--r-- | mm/swap_state.c | 4 | ||||
-rw-r--r-- | mm/vmscan.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index 997d838f0e70..eb591eaad1b7 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -198,7 +198,7 @@ extern int rw_swap_page_sync(int, swp_entry_t, struct page *); | |||
198 | extern struct address_space swapper_space; | 198 | extern struct address_space swapper_space; |
199 | #define total_swapcache_pages swapper_space.nrpages | 199 | #define total_swapcache_pages swapper_space.nrpages |
200 | extern void show_swap_cache_info(void); | 200 | extern void show_swap_cache_info(void); |
201 | extern int add_to_swap(struct page *); | 201 | extern int add_to_swap(struct page *, gfp_t); |
202 | extern void __delete_from_swap_cache(struct page *); | 202 | extern void __delete_from_swap_cache(struct page *); |
203 | extern void delete_from_swap_cache(struct page *); | 203 | extern void delete_from_swap_cache(struct page *); |
204 | extern int move_to_swap_cache(struct page *, swp_entry_t); | 204 | extern int move_to_swap_cache(struct page *, swp_entry_t); |
diff --git a/mm/swap_state.c b/mm/swap_state.c index fc2aecb70a95..7b09ac503fec 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c | |||
@@ -141,7 +141,7 @@ void __delete_from_swap_cache(struct page *page) | |||
141 | * Allocate swap space for the page and add the page to the | 141 | * Allocate swap space for the page and add the page to the |
142 | * swap cache. Caller needs to hold the page lock. | 142 | * swap cache. Caller needs to hold the page lock. |
143 | */ | 143 | */ |
144 | int add_to_swap(struct page * page) | 144 | int add_to_swap(struct page * page, gfp_t gfp_mask) |
145 | { | 145 | { |
146 | swp_entry_t entry; | 146 | swp_entry_t entry; |
147 | int err; | 147 | int err; |
@@ -166,7 +166,7 @@ int add_to_swap(struct page * page) | |||
166 | * Add it to the swap cache and mark it dirty | 166 | * Add it to the swap cache and mark it dirty |
167 | */ | 167 | */ |
168 | err = __add_to_swap_cache(page, entry, | 168 | err = __add_to_swap_cache(page, entry, |
169 | GFP_ATOMIC|__GFP_NOMEMALLOC|__GFP_NOWARN); | 169 | gfp_mask|__GFP_NOMEMALLOC|__GFP_NOWARN); |
170 | 170 | ||
171 | switch (err) { | 171 | switch (err) { |
172 | case 0: /* Success */ | 172 | case 0: /* Success */ |
diff --git a/mm/vmscan.c b/mm/vmscan.c index daed4a73b761..5393b093a87b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -458,7 +458,7 @@ static int shrink_list(struct list_head *page_list, struct scan_control *sc) | |||
458 | * Try to allocate it some swap space here. | 458 | * Try to allocate it some swap space here. |
459 | */ | 459 | */ |
460 | if (PageAnon(page) && !PageSwapCache(page)) { | 460 | if (PageAnon(page) && !PageSwapCache(page)) { |
461 | if (!add_to_swap(page)) | 461 | if (!add_to_swap(page, GFP_ATOMIC)) |
462 | goto activate_locked; | 462 | goto activate_locked; |
463 | } | 463 | } |
464 | #endif /* CONFIG_SWAP */ | 464 | #endif /* CONFIG_SWAP */ |
@@ -715,7 +715,7 @@ redo: | |||
715 | } | 715 | } |
716 | 716 | ||
717 | if (PageAnon(page) && !PageSwapCache(page)) { | 717 | if (PageAnon(page) && !PageSwapCache(page)) { |
718 | if (!add_to_swap(page)) { | 718 | if (!add_to_swap(page, GFP_KERNEL)) { |
719 | unlock_page(page); | 719 | unlock_page(page); |
720 | list_move(&page->lru, &failed); | 720 | list_move(&page->lru, &failed); |
721 | nr_failed++; | 721 | nr_failed++; |