Skip to content

Commit

Permalink
[PATCH] Allow migration of mlocked pages
Browse files Browse the repository at this point in the history
Hugh clarified the role of VM_LOCKED.  So we can now implement page
migration for mlocked pages.

Allow the migration of mlocked pages.  This means that try_to_unmap must
unmap mlocked pages in the migration case.

Signed-off-by: Christoph Lameter <[email protected]>
Acked-by: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Jun 25, 2006
1 parent 7b2259b commit e6a1530
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
10 changes: 4 additions & 6 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,13 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
/*
* Establish migration ptes or remove ptes
*/
if (try_to_unmap(page, 1) != SWAP_FAIL) {
if (!page_mapped(page))
rc = move_to_new_page(newpage, page);
} else
/* A vma has VM_LOCKED set -> permanent failure */
rc = -EPERM;
try_to_unmap(page, 1);
if (!page_mapped(page))
rc = move_to_new_page(newpage, page);

if (rc)
remove_migration_ptes(page, page);

unlock:
unlock_page(page);

Expand Down
9 changes: 4 additions & 5 deletions mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,8 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
* If it's recently referenced (perhaps page_referenced
* skipped over this mm) then we should reactivate it.
*/
if ((vma->vm_flags & VM_LOCKED) ||
(ptep_clear_flush_young(vma, address, pte)
&& !migration)) {
if (!migration && ((vma->vm_flags & VM_LOCKED) ||
(ptep_clear_flush_young(vma, address, pte)))) {
ret = SWAP_FAIL;
goto out_unmap;
}
Expand Down Expand Up @@ -771,7 +770,7 @@ static int try_to_unmap_file(struct page *page, int migration)

list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
shared.vm_set.list) {
if (vma->vm_flags & VM_LOCKED)
if ((vma->vm_flags & VM_LOCKED) && !migration)
continue;
cursor = (unsigned long) vma->vm_private_data;
if (cursor > max_nl_cursor)
Expand Down Expand Up @@ -805,7 +804,7 @@ static int try_to_unmap_file(struct page *page, int migration)
do {
list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
shared.vm_set.list) {
if (vma->vm_flags & VM_LOCKED)
if ((vma->vm_flags & VM_LOCKED) && !migration)
continue;
cursor = (unsigned long) vma->vm_private_data;
while ( cursor < max_nl_cursor &&
Expand Down

0 comments on commit e6a1530

Please sign in to comment.