mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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: Hugh Dickins <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: "Jun'ichi Nomura" <[email protected]> Cc: Andi Kleen <[email protected]> Cc: <[email protected]> [2.6.37, 2.6.36] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
1ce82b69e9
commit
fd4a4663db
1 changed files with 6 additions and 17 deletions
23
mm/migrate.c
23
mm/migrate.c
|
|
@ -827,7 +827,6 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
|
|||
int rc = 0;
|
||||
int *result = NULL;
|
||||
struct page *new_hpage = get_new_page(hpage, private, &result);
|
||||
int rcu_locked = 0;
|
||||
struct anon_vma *anon_vma = NULL;
|
||||
|
||||
if (!new_hpage)
|
||||
|
|
@ -842,12 +841,10 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
|
|||
}
|
||||
|
||||
if (PageAnon(hpage)) {
|
||||
rcu_read_lock();
|
||||
rcu_locked = 1;
|
||||
|
||||
if (page_mapped(hpage)) {
|
||||
anon_vma = page_anon_vma(hpage);
|
||||
atomic_inc(&anon_vma->external_refcount);
|
||||
anon_vma = page_lock_anon_vma(hpage);
|
||||
if (anon_vma) {
|
||||
get_anon_vma(anon_vma);
|
||||
page_unlock_anon_vma(anon_vma);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -859,16 +856,8 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
|
|||
if (rc)
|
||||
remove_migration_ptes(hpage, hpage);
|
||||
|
||||
if (anon_vma && atomic_dec_and_lock(&anon_vma->external_refcount,
|
||||
&anon_vma->lock)) {
|
||||
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();
|
||||
if (anon_vma)
|
||||
drop_anon_vma(anon_vma);
|
||||
out:
|
||||
unlock_page(hpage);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue