Skip to content

Commit

Permalink
memory hotplug: migrate swap cache page
Browse files Browse the repository at this point in the history
In test, some pages in swap-cache can't be migrated, as they aren't rmap.

unmap_and_move() ignores swap-cache page which is just read in and hasn't
rmap (see the comments in the code), but swap_aops provides .migratepage.
Better to migrate such pages instead of ignore them.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Yakui Zhao <yakui.zhao@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Shaohua Li authored and Linus Torvalds committed Sep 22, 2009
1 parent f52407c commit abfc348
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void remove_migration_pte(struct vm_area_struct *vma,
static void remove_file_migration_ptes(struct page *old, struct page *new)
{
struct vm_area_struct *vma;
struct address_space *mapping = page_mapping(new);
struct address_space *mapping = new->mapping;
struct prio_tree_iter iter;
pgoff_t pgoff = new->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);

Expand Down Expand Up @@ -664,13 +664,15 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
* needs to be effective.
*/
try_to_free_buffers(page);
goto rcu_unlock;
}
goto rcu_unlock;
goto skip_unmap;
}

/* Establish migration ptes or remove ptes */
try_to_unmap(page, 1);

skip_unmap:
if (!page_mapped(page))
rc = move_to_new_page(newpage, page);

Expand Down

0 comments on commit abfc348

Please sign in to comment.