aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2006-01-08 01:00:55 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 20:12:42 -0800
commitd498471133ff1f9586a06820beaeebc575fe2814 (patch)
treec7cde93441692e3b32d83dfbf85858ab2d85e481 /mm/vmscan.c
parentee27497df36823f2793212cad0997c044eb0e1eb (diff)
downloadkernel_samsung_aries-d498471133ff1f9586a06820beaeebc575fe2814.zip
kernel_samsung_aries-d498471133ff1f9586a06820beaeebc575fe2814.tar.gz
kernel_samsung_aries-d498471133ff1f9586a06820beaeebc575fe2814.tar.bz2
[PATCH] SwapMig: Extend parameters for migrate_pages()
Extend the parameters of migrate_pages() to allow the caller control over the fate of successfully migrated or impossible to migrate pages. Swap migration and direct migration will have the same interface after this patch so that patches can be independently applied to the policy layer and the core migration code. Signed-off-by: Christoph Lameter <clameter@sgi.com> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 73ba404..5eecb51 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -670,10 +670,10 @@ retry:
* list. The direct migration patchset
* extends this function to avoid the use of swap.
*/
-int migrate_pages(struct list_head *l, struct list_head *t)
+int migrate_pages(struct list_head *from, struct list_head *to,
+ struct list_head *moved, struct list_head *failed)
{
int retry;
- LIST_HEAD(failed);
int nr_failed = 0;
int pass = 0;
struct page *page;
@@ -686,12 +686,12 @@ int migrate_pages(struct list_head *l, struct list_head *t)
redo:
retry = 0;
- list_for_each_entry_safe(page, page2, l, lru) {
+ list_for_each_entry_safe(page, page2, from, lru) {
cond_resched();
if (page_count(page) == 1) {
/* page was freed from under us. So we are done. */
- move_to_lru(page);
+ list_move(&page->lru, moved);
continue;
}
/*
@@ -722,7 +722,7 @@ redo:
if (PageAnon(page) && !PageSwapCache(page)) {
if (!add_to_swap(page, GFP_KERNEL)) {
unlock_page(page);
- list_move(&page->lru, &failed);
+ list_move(&page->lru, failed);
nr_failed++;
continue;
}
@@ -732,8 +732,10 @@ redo:
* Page is properly locked and writeback is complete.
* Try to migrate the page.
*/
- if (!swap_page(page))
+ if (!swap_page(page)) {
+ list_move(&page->lru, moved);
continue;
+ }
retry_later:
retry++;
}
@@ -743,9 +745,6 @@ retry_later:
if (!swapwrite)
current->flags &= ~PF_SWAPWRITE;
- if (!list_empty(&failed))
- list_splice(&failed, l);
-
return nr_failed + retry;
}