3/4 Migration Cache - move migration cache page to swap cache
Subsystems (5)
RFC 1/1 3/4 Migration Cache - move migration cache page to swap cache
Migration Cache "V8" 3/4
This patch modifies the swapfile.c "unuse_*" stack to support moving pages from migration cache to swap cache in case we have to "fall back to swap". This also allows vmscan.c:shrink_list() to move migration cache pages to swap cache when/if it wants to swap them out. shrink_list() should only find anon pages in the migration cache when/if we implement lazy page migration.
Because of the new usage, the patch renames the static "unuse_*" functions in swapfile.c to "update_*". In "update_pte_range", if the entry arg matches the page's private data, we perform the usual "unuse_pte()"; otherwise, this is an "update/move" operation and we "update_pte()".
Then, this patch implements the __migration_move_to_swap() function on top of the modified "update_*" stack.
Assumption: because this facility is used only for removing swap devices [sys_swapoff()] and direct page migration, it is not in a critical/fast path. Even so, this patch doesn't add significant overhead to the stack [he says, glibly].
include/linux/swap.h +3 -1
@@ -197,6 +197,7 @@ extern int migrate_page_remove_referenceextern unsigned long migrate_pages (struct list_head *l,struct list_head *t,struct list_head *moved,struct list_head *failed);extern int fail_migrate_page (struct page *,struct page *); +extern int remove_vma_swap (struct vm_area_struct *,struct page *);extern int add_to_migration_cache (struct page *,int );extern void migration_remove_entry (swp_entry_t ,int );
@@ -206,6 +207,8 @@ extern void migration_remove_reference(sextern void __migration_remove_reference (struct page *,swp_entry_t ,int );extern struct page *lookup_migration_cache (swp_entry_t ); +extern int __migration_move_to_swap (struct vm_area_struct *,struct page *, +swp_entry_t );#else static inline int isolate_lru_page (struct page *p) {return -ENOSYS ; }static inline int putback_lru_pages (struct list_head *l) {return 0 ; }
@@ -279,7 +282,6 @@ extern int remove_exclusive_swap_page(ststruct backing_dev_info ;extern spinlock_t swap_lock; -extern int remove_vma_swap (struct vm_area_struct *vma,struct page *page);/* linux/mm/thrash.c */ extern struct mm_struct * swap_token_mm;
mm/swapfile.c +59 -10
137 lines not on this page · raw message
include/linux/rmap.h +1 -0
@@ -93,6 +93,7 @@ static inline void page_dup_rmap(structint page_referenced (struct page *,int is_locked);int try_to_unmap (struct page *,int ignore_refs);void remove_from_swap (struct page *page); +int migration_move_to_swap (struct page *);/* * Called from mm/filemap_xip.c to unmap empty zero page
mm/rmap.c +66 -0
72 lines not on this page · raw message
mm/vmscan.c +2 -5
@@ -464,11 +464,8 @@ static unsigned long shrink_page_list(stif (!add_to_swap (page,GFP_ATOMIC )) goto activate_locked; }else if (page_is_migration (page)) { -/* -* For now, skip migration cache pages. -* TODO: move to swap cache [difficult?] -*/ - goto keep_locked; +if (!migration_move_to_swap (page)) + goto keep_locked; } }#endif /* CONFIG_SWAP */
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>