diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2011-01-13 18:46:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:40 -0500 |
commit | 8ac1f8320a0073f28cf9e0491af4cd98f504f92a (patch) | |
tree | 4dad891c302587fdc7b099b18e05d7dbc5526c64 /mm/mremap.c | |
parent | 64cc6ae001d70bc59e5f854e6b5678f59110df16 (diff) |
thp: pte alloc trans splitting
pte alloc routines must wait for split_huge_page if the pmd is not present
and not null (i.e. pmd_trans_splitting). The additional branches are
optimized away at compile time by pmd_trans_splitting if the config option
is off. However we must pass the vma down in order to know the anon_vma
lock to wait for.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mremap.c')
-rw-r--r-- | mm/mremap.c | 8 |
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 | ||
50 | static pmd_t *alloc_new_pmd(struct mm_struct *mm, unsigned long addr) | 50 | static 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; |