]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] Swapless page migration: rip out swap based logic
authorChristoph Lameter <clameter@sgi.com>
Fri, 23 Jun 2006 09:03:36 +0000 (02:03 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 23 Jun 2006 14:42:50 +0000 (07:42 -0700)
Rip the page migration logic out.

Remove all code that has to do with swapping during page migration.

This also guts the ability to migrate pages to swap.  No one used that so lets
let it go for good.

Page migration should be a bit broken after this patch.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/rmap.h
mm/migrate.c
mm/rmap.c
mm/swapfile.c

index 2d4c81a220db21bd91157e06390488a5a1b71f1c..bf97b0900014ae204869139f0febb671a7988df6 100644 (file)
@@ -91,7 +91,6 @@ static inline void page_dup_rmap(struct page *page)
  */
 int page_referenced(struct page *, int is_locked);
 int try_to_unmap(struct page *, int ignore_refs);
-void remove_from_swap(struct page *page);
 
 /*
  * Called from mm/filemap_xip.c to unmap empty zero page
index 0a011e421bb4d8887e8ca14e2e141606a7693111..81721a061d50a4711e40a3663bd1a43529d85e45 100644 (file)
@@ -70,10 +70,6 @@ int isolate_lru_page(struct page *page, struct list_head *pagelist)
  */
 int migrate_prep(void)
 {
-       /* Must have swap device for migration */
-       if (nr_swap_pages <= 0)
-               return -ENODEV;
-
        /*
         * Clear the LRU lists so pages can be isolated.
         * Note that pages may be moved off the LRU after we have
@@ -245,52 +241,6 @@ out:
        pte_unmap_unlock(ptep, ptl);
 }
 
-/*
- * swapout a single page
- * page is locked upon entry, unlocked on exit
- */
-static int swap_page(struct page *page)
-{
-       struct address_space *mapping = page_mapping(page);
-
-       if (page_mapped(page) && mapping)
-               if (try_to_unmap(page, 1) != SWAP_SUCCESS)
-                       goto unlock_retry;
-
-       if (PageDirty(page)) {
-               /* Page is dirty, try to write it out here */
-               switch(pageout(page, mapping)) {
-               case PAGE_KEEP:
-               case PAGE_ACTIVATE:
-                       goto unlock_retry;
-
-               case PAGE_SUCCESS:
-                       goto retry;
-
-               case PAGE_CLEAN:
-                       ; /* try to free the page below */
-               }
-       }
-
-       if (PagePrivate(page)) {
-               if (!try_to_release_page(page, GFP_KERNEL) ||
-                   (!mapping && page_count(page) == 1))
-                       goto unlock_retry;
-       }
-
-       if (remove_mapping(mapping, page)) {
-               /* Success */
-               unlock_page(page);
-               return 0;
-       }
-
-unlock_retry:
-       unlock_page(page);
-
-retry:
-       return -EAGAIN;
-}
-
 /*
  * Replace the page in the mapping.
  *
@@ -517,8 +467,7 @@ static int fallback_migrate_page(struct address_space *mapping,
  * Two lists are passed to this function. The first list
  * contains the pages isolated from the LRU to be migrated.
  * The second list contains new pages that the pages isolated
- * can be moved to. If the second list is NULL then all
- * pages are swapped out.
+ * can be moved to.
  *
  * The function returns after 10 attempts or if no pages
  * are movable anymore because to has become empty
@@ -574,29 +523,11 @@ redo:
                 * Only wait on writeback if we have already done a pass where
                 * we we may have triggered writeouts for lots of pages.
                 */
-               if (pass > 0) {
+               if (pass > 0)
                        wait_on_page_writeback(page);
-               } else {
+               else
                        if (PageWriteback(page))
                                goto unlock_page;
-               }
-
-               /*
-                * Anonymous pages must have swap cache references otherwise
-                * the information contained in the page maps cannot be
-                * preserved.
-                */
-               if (PageAnon(page) && !PageSwapCache(page)) {
-                       if (!add_to_swap(page, GFP_KERNEL)) {
-                               rc = -ENOMEM;
-                               goto unlock_page;
-                       }
-               }
-
-               if (!to) {
-                       rc = swap_page(page);
-                       goto next;
-               }
 
                /*
                 * Establish swap ptes for anonymous pages or destroy pte
index 3b8ce86daa3a6600845d78174a5506b8fe738166..a53a10b93ecffd53072ae7193df6338500313dac 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -205,44 +205,6 @@ out:
        return anon_vma;
 }
 
-#ifdef CONFIG_MIGRATION
-/*
- * Remove an anonymous page from swap replacing the swap pte's
- * through real pte's pointing to valid pages and then releasing
- * the page from the swap cache.
- *
- * Must hold page lock on page and mmap_sem of one vma that contains
- * the page.
- */
-void remove_from_swap(struct page *page)
-{
-       struct anon_vma *anon_vma;
-       struct vm_area_struct *vma;
-       unsigned long mapping;
-
-       if (!PageSwapCache(page))
-               return;
-
-       mapping = (unsigned long)page->mapping;
-
-       if (!mapping || (mapping & PAGE_MAPPING_ANON) == 0)
-               return;
-
-       /*
-        * We hold the mmap_sem lock. So no need to call page_lock_anon_vma.
-        */
-       anon_vma = (struct anon_vma *) (mapping - PAGE_MAPPING_ANON);
-       spin_lock(&anon_vma->lock);
-
-       list_for_each_entry(vma, &anon_vma->head, anon_vma_node)
-               remove_vma_swap(vma, page);
-
-       spin_unlock(&anon_vma->lock);
-       delete_from_swap_cache(page);
-}
-EXPORT_SYMBOL(remove_from_swap);
-#endif
-
 /*
  * At what user virtual address is page expected in vma?
  */
index e3b1362372c2ff8054c664113c39174687348b6a..fbceed67a075336146a8653a9fc234e7ea54503a 100644 (file)
@@ -618,15 +618,6 @@ static int unuse_mm(struct mm_struct *mm,
        return 0;
 }
 
-#ifdef CONFIG_MIGRATION
-int remove_vma_swap(struct vm_area_struct *vma, struct page *page)
-{
-       swp_entry_t entry = { .val = page_private(page) };
-
-       return unuse_vma(vma, entry, page);
-}
-#endif
-
 /*
  * Scan swap_map from current position to next entry still in use.
  * Recycle to start on reaching the end, returning 0 when empty.