diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-01-08 04:00:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-08 23:12:42 -0500 |
commit | 1480a540c98525640174a7eadd712378fcd6fd63 (patch) | |
tree | 28f2cc0aa819ff0aed30dd85bb16177d4a73002b /mm/swap_state.c | |
parent | 8419c3181086c86664e8246bc997afc2e4ffba4f (diff) |
[PATCH] SwapMig: add_to_swap() avoid atomic allocations
Add gfp_mask to add_to_swap
add_to_swap does allocations with GFP_ATOMIC in order not to interfere with
swapping. During migration we may have use add_to_swap extensively which may
lead to out of memory errors.
This patch makes add_to_swap take a parameter that specifies the gfp mask.
The page migration code can then make add_to_swap use GFP_KERNEL.
Signed-off-by: Hirokazu Takahashi <taka@valinux.co.jp>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r-- | mm/swap_state.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 */ |