diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-02-01 06:05:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 11:53:17 -0500 |
commit | e965f9630c651fa4249039fd4b80c9392d07a856 (patch) | |
tree | 1353dd536d0ee549c30e462086624c21788ee9d2 /mm | |
parent | 7e2ab150d1b3b286a4c864c60a549b2601777b63 (diff) |
[PATCH] Direct Migration V9: Avoid writeback / page_migrate() method
Migrate a page with buffers without requiring writeback
This introduces a new address space operation migratepage() that may be used
by a filesystem to implement its own version of page migration.
A version is provided that migrates buffers attached to pages. Some
filesystems (ext2, ext3, xfs) are modified to utilize this feature.
The swapper address space operation are modified so that a regular
migrate_page() will occur for anonymous pages without writeback (migrate_pages
forces every anonymous page to have a swap entry).
Signed-off-by: Mike Kravetz <kravetz@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')
-rw-r--r-- | mm/rmap.c | 1 | ||||
-rw-r--r-- | mm/swap_state.c | 1 | ||||
-rw-r--r-- | mm/vmscan.c | 20 |
3 files changed, 21 insertions, 1 deletions
@@ -233,6 +233,7 @@ void remove_from_swap(struct page *page) | |||
233 | 233 | ||
234 | delete_from_swap_cache(page); | 234 | delete_from_swap_cache(page); |
235 | } | 235 | } |
236 | EXPORT_SYMBOL(remove_from_swap); | ||
236 | #endif | 237 | #endif |
237 | 238 | ||
238 | /* | 239 | /* |
diff --git a/mm/swap_state.c b/mm/swap_state.c index 7b09ac503fec..db8a3d3e1636 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c | |||
@@ -27,6 +27,7 @@ static struct address_space_operations swap_aops = { | |||
27 | .writepage = swap_writepage, | 27 | .writepage = swap_writepage, |
28 | .sync_page = block_sync_page, | 28 | .sync_page = block_sync_page, |
29 | .set_page_dirty = __set_page_dirty_nobuffers, | 29 | .set_page_dirty = __set_page_dirty_nobuffers, |
30 | .migratepage = migrate_page, | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | static struct backing_dev_info swap_backing_dev_info = { | 33 | static struct backing_dev_info swap_backing_dev_info = { |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 5e98b86feb74..5a610804cd06 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -615,6 +615,15 @@ int putback_lru_pages(struct list_head *l) | |||
615 | } | 615 | } |
616 | 616 | ||
617 | /* | 617 | /* |
618 | * Non migratable page | ||
619 | */ | ||
620 | int fail_migrate_page(struct page *newpage, struct page *page) | ||
621 | { | ||
622 | return -EIO; | ||
623 | } | ||
624 | EXPORT_SYMBOL(fail_migrate_page); | ||
625 | |||
626 | /* | ||
618 | * swapout a single page | 627 | * swapout a single page |
619 | * page is locked upon entry, unlocked on exit | 628 | * page is locked upon entry, unlocked on exit |
620 | */ | 629 | */ |
@@ -659,6 +668,7 @@ unlock_retry: | |||
659 | retry: | 668 | retry: |
660 | return -EAGAIN; | 669 | return -EAGAIN; |
661 | } | 670 | } |
671 | EXPORT_SYMBOL(swap_page); | ||
662 | 672 | ||
663 | /* | 673 | /* |
664 | * Page migration was first developed in the context of the memory hotplug | 674 | * Page migration was first developed in the context of the memory hotplug |
@@ -674,7 +684,7 @@ retry: | |||
674 | * Remove references for a page and establish the new page with the correct | 684 | * Remove references for a page and establish the new page with the correct |
675 | * basic settings to be able to stop accesses to the page. | 685 | * basic settings to be able to stop accesses to the page. |
676 | */ | 686 | */ |
677 | static int migrate_page_remove_references(struct page *newpage, | 687 | int migrate_page_remove_references(struct page *newpage, |
678 | struct page *page, int nr_refs) | 688 | struct page *page, int nr_refs) |
679 | { | 689 | { |
680 | struct address_space *mapping = page_mapping(page); | 690 | struct address_space *mapping = page_mapping(page); |
@@ -749,6 +759,7 @@ static int migrate_page_remove_references(struct page *newpage, | |||
749 | 759 | ||
750 | return 0; | 760 | return 0; |
751 | } | 761 | } |
762 | EXPORT_SYMBOL(migrate_page_remove_references); | ||
752 | 763 | ||
753 | /* | 764 | /* |
754 | * Copy the page to its new location | 765 | * Copy the page to its new location |
@@ -788,6 +799,7 @@ void migrate_page_copy(struct page *newpage, struct page *page) | |||
788 | if (PageWriteback(newpage)) | 799 | if (PageWriteback(newpage)) |
789 | end_page_writeback(newpage); | 800 | end_page_writeback(newpage); |
790 | } | 801 | } |
802 | EXPORT_SYMBOL(migrate_page_copy); | ||
791 | 803 | ||
792 | /* | 804 | /* |
793 | * Common logic to directly migrate a single page suitable for | 805 | * Common logic to directly migrate a single page suitable for |
@@ -815,6 +827,7 @@ int migrate_page(struct page *newpage, struct page *page) | |||
815 | remove_from_swap(newpage); | 827 | remove_from_swap(newpage); |
816 | return 0; | 828 | return 0; |
817 | } | 829 | } |
830 | EXPORT_SYMBOL(migrate_page); | ||
818 | 831 | ||
819 | /* | 832 | /* |
820 | * migrate_pages | 833 | * migrate_pages |
@@ -914,6 +927,11 @@ redo: | |||
914 | if (!mapping) | 927 | if (!mapping) |
915 | goto unlock_both; | 928 | goto unlock_both; |
916 | 929 | ||
930 | if (mapping->a_ops->migratepage) { | ||
931 | rc = mapping->a_ops->migratepage(newpage, page); | ||
932 | goto unlock_both; | ||
933 | } | ||
934 | |||
917 | /* | 935 | /* |
918 | * Trigger writeout if page is dirty | 936 | * Trigger writeout if page is dirty |
919 | */ | 937 | */ |