Commit fd4a4663 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

mm: fix hugepage migration

2.6.37 added an unmap_and_move_huge_page() for memory failure recovery,
but its anon_vma handling was still based around the 2.6.35 conventions.
Update it to use page_lock_anon_vma, get_anon_vma, page_unlock_anon_vma,
drop_anon_vma in the same way as we're now changing unmap_and_move().

I don't particularly like to propose this for stable when I've not seen
its problems in practice nor tested the solution: but it's clearly out of
synch at present.
Signed-off-by: default avatarHugh Dickins <hughd@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Rik van Riel <riel@redhat.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: <stable@kernel.org> [2.6.37, 2.6.36]
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1ce82b69
...@@ -827,7 +827,6 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, ...@@ -827,7 +827,6 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
int rc = 0; int rc = 0;
int *result = NULL; int *result = NULL;
struct page *new_hpage = get_new_page(hpage, private, &result); struct page *new_hpage = get_new_page(hpage, private, &result);
int rcu_locked = 0;
struct anon_vma *anon_vma = NULL; struct anon_vma *anon_vma = NULL;
if (!new_hpage) if (!new_hpage)
...@@ -842,12 +841,10 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, ...@@ -842,12 +841,10 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
} }
if (PageAnon(hpage)) { if (PageAnon(hpage)) {
rcu_read_lock(); anon_vma = page_lock_anon_vma(hpage);
rcu_locked = 1; if (anon_vma) {
get_anon_vma(anon_vma);
if (page_mapped(hpage)) { page_unlock_anon_vma(anon_vma);
anon_vma = page_anon_vma(hpage);
atomic_inc(&anon_vma->external_refcount);
} }
} }
...@@ -859,16 +856,8 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, ...@@ -859,16 +856,8 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
if (rc) if (rc)
remove_migration_ptes(hpage, hpage); remove_migration_ptes(hpage, hpage);
if (anon_vma && atomic_dec_and_lock(&anon_vma->external_refcount, if (anon_vma)
&anon_vma->lock)) { drop_anon_vma(anon_vma);
int empty = list_empty(&anon_vma->head);
spin_unlock(&anon_vma->lock);
if (empty)
anon_vma_free(anon_vma);
}
if (rcu_locked)
rcu_read_unlock();
out: out:
unlock_page(hpage); unlock_page(hpage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment