summaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
authorBob Liu <lliubbo@gmail.com>2012-12-11 16:00:37 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 17:22:22 -0800
commit6219049ae1ce32b89236646cccaec2a5fc6c4fd2 (patch)
tree551e8b1d53b8d237678c96cb9b442c746609cfcd /mm/migrate.c
parent344aa35c27acdf70d3c67b5aa7cb6aa8585f80c1 (diff)
downloadop-kernel-dev-6219049ae1ce32b89236646cccaec2a5fc6c4fd2.zip
op-kernel-dev-6219049ae1ce32b89236646cccaec2a5fc6c4fd2.tar.gz
mm: introduce mm_find_pmd()
Several place need to find the pmd by(mm_struct, address), so introduce a function to simplify it. [akpm@linux-foundation.org: fix warning] Signed-off-by: Bob Liu <lliubbo@gmail.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: Ni zhan Chen <nizhan.chen@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/migrate.c')
-rw-r--r--mm/migrate.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index 77ed2d7..1dc4598 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -91,8 +91,6 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
{
struct mm_struct *mm = vma->vm_mm;
swp_entry_t entry;
- pgd_t *pgd;
- pud_t *pud;
pmd_t *pmd;
pte_t *ptep, pte;
spinlock_t *ptl;
@@ -103,19 +101,11 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
goto out;
ptl = &mm->page_table_lock;
} else {
- pgd = pgd_offset(mm, addr);
- if (!pgd_present(*pgd))
+ pmd = mm_find_pmd(mm, addr);
+ if (!pmd)
goto out;
-
- pud = pud_offset(pgd, addr);
- if (!pud_present(*pud))
- goto out;
-
- pmd = pmd_offset(pud, addr);
if (pmd_trans_huge(*pmd))
goto out;
- if (!pmd_present(*pmd))
- goto out;
ptep = pte_offset_map(pmd, addr);
OpenPOWER on IntegriCloud