aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mremap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mremap.c')
-rw-r--r--mm/mremap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mm/mremap.c b/mm/mremap.c
index 563fbdd6293a..b09eefaea0b8 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -47,7 +47,8 @@ static pmd_t *get_old_pmd(struct mm_struct *mm, unsigned long addr)
47 return pmd; 47 return pmd;
48} 48}
49 49
50static pmd_t *alloc_new_pmd(struct mm_struct *mm, unsigned long addr) 50static pmd_t *alloc_new_pmd(struct mm_struct *mm, struct vm_area_struct *vma,
51 unsigned long addr)
51{ 52{
52 pgd_t *pgd; 53 pgd_t *pgd;
53 pud_t *pud; 54 pud_t *pud;
@@ -62,7 +63,8 @@ static pmd_t *alloc_new_pmd(struct mm_struct *mm, unsigned long addr)
62 if (!pmd) 63 if (!pmd)
63 return NULL; 64 return NULL;
64 65
65 if (!pmd_present(*pmd) && __pte_alloc(mm, pmd, addr)) 66 VM_BUG_ON(pmd_trans_huge(*pmd));
67 if (pmd_none(*pmd) && __pte_alloc(mm, vma, pmd, addr))
66 return NULL; 68 return NULL;
67 69
68 return pmd; 70 return pmd;
@@ -147,7 +149,7 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
147 old_pmd = get_old_pmd(vma->vm_mm, old_addr); 149 old_pmd = get_old_pmd(vma->vm_mm, old_addr);
148 if (!old_pmd) 150 if (!old_pmd)
149 continue; 151 continue;
150 new_pmd = alloc_new_pmd(vma->vm_mm, new_addr); 152 new_pmd = alloc_new_pmd(vma->vm_mm, vma, new_addr);
151 if (!new_pmd) 153 if (!new_pmd)
152 break; 154 break;
153 next = (new_addr + PMD_SIZE) & PMD_MASK; 155 next = (new_addr + PMD_SIZE) & PMD_MASK;