diff options
-rw-r--r-- | mm/vmscan.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 5a610804cd06..5db32fdfaf39 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -632,7 +632,7 @@ static int swap_page(struct page *page) | |||
632 | struct address_space *mapping = page_mapping(page); | 632 | struct address_space *mapping = page_mapping(page); |
633 | 633 | ||
634 | if (page_mapped(page) && mapping) | 634 | if (page_mapped(page) && mapping) |
635 | if (try_to_unmap(page, 0) != SWAP_SUCCESS) | 635 | if (try_to_unmap(page, 1) != SWAP_SUCCESS) |
636 | goto unlock_retry; | 636 | goto unlock_retry; |
637 | 637 | ||
638 | if (PageDirty(page)) { | 638 | if (PageDirty(page)) { |
@@ -839,7 +839,7 @@ EXPORT_SYMBOL(migrate_page); | |||
839 | * pages are swapped out. | 839 | * pages are swapped out. |
840 | * | 840 | * |
841 | * The function returns after 10 attempts or if no pages | 841 | * The function returns after 10 attempts or if no pages |
842 | * are movable anymore because t has become empty | 842 | * are movable anymore because to has become empty |
843 | * or no retryable pages exist anymore. | 843 | * or no retryable pages exist anymore. |
844 | * | 844 | * |
845 | * Return: Number of pages not migrated when "to" ran empty. | 845 | * Return: Number of pages not migrated when "to" ran empty. |
@@ -928,12 +928,21 @@ redo: | |||
928 | goto unlock_both; | 928 | goto unlock_both; |
929 | 929 | ||
930 | if (mapping->a_ops->migratepage) { | 930 | if (mapping->a_ops->migratepage) { |
931 | /* | ||
932 | * Most pages have a mapping and most filesystems | ||
933 | * should provide a migration function. Anonymous | ||
934 | * pages are part of swap space which also has its | ||
935 | * own migration function. This is the most common | ||
936 | * path for page migration. | ||
937 | */ | ||
931 | rc = mapping->a_ops->migratepage(newpage, page); | 938 | rc = mapping->a_ops->migratepage(newpage, page); |
932 | goto unlock_both; | 939 | goto unlock_both; |
933 | } | 940 | } |
934 | 941 | ||
935 | /* | 942 | /* |
936 | * Trigger writeout if page is dirty | 943 | * Default handling if a filesystem does not provide |
944 | * a migration function. We can only migrate clean | ||
945 | * pages so try to write out any dirty pages first. | ||
937 | */ | 946 | */ |
938 | if (PageDirty(page)) { | 947 | if (PageDirty(page)) { |
939 | switch (pageout(page, mapping)) { | 948 | switch (pageout(page, mapping)) { |
@@ -949,9 +958,10 @@ redo: | |||
949 | ; /* try to migrate the page below */ | 958 | ; /* try to migrate the page below */ |
950 | } | 959 | } |
951 | } | 960 | } |
961 | |||
952 | /* | 962 | /* |
953 | * If we have no buffer or can release the buffer | 963 | * Buffers are managed in a filesystem specific way. |
954 | * then do a simple migration. | 964 | * We must have no buffers or drop them. |
955 | */ | 965 | */ |
956 | if (!page_has_buffers(page) || | 966 | if (!page_has_buffers(page) || |
957 | try_to_release_page(page, GFP_KERNEL)) { | 967 | try_to_release_page(page, GFP_KERNEL)) { |
@@ -966,6 +976,11 @@ redo: | |||
966 | * swap them out. | 976 | * swap them out. |
967 | */ | 977 | */ |
968 | if (pass > 4) { | 978 | if (pass > 4) { |
979 | /* | ||
980 | * Persistently unable to drop buffers..... As a | ||
981 | * measure of last resort we fall back to | ||
982 | * swap_page(). | ||
983 | */ | ||
969 | unlock_page(newpage); | 984 | unlock_page(newpage); |
970 | newpage = NULL; | 985 | newpage = NULL; |
971 | rc = swap_page(page); | 986 | rc = swap_page(page); |