diff options
author | Hugh Dickins <hughd@google.com> | 2013-10-16 16:47:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-10-17 00:35:53 -0400 |
commit | 57a8f0cdb87da776bf0e4ce7554a9133854fa779 (patch) | |
tree | fe920bc16fe4ef97e94d31fce5f25bbecaff6e57 /mm/mremap.c | |
parent | 750e8165f5e87b6a142be953640eabb13a9d350a (diff) |
mm: revert mremap pud_free anti-fix
Revert commit 1ecfd533f4c5 ("mm/mremap.c: call pud_free() after fail
calling pmd_alloc()").
The original code was correct: pud_alloc(), pmd_alloc(), pte_alloc_map()
ensure that the pud, pmd, pt is already allocated, and seldom do they
need to allocate; on failure, upper levels are freed if appropriate by
the subsequent do_munmap(). Whereas commit 1ecfd533f4c5 did an
unconditional pud_free() of a most-likely still-in-use pud: saved only
by the near-impossiblity of pmd_alloc() failing.
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Chen Gang <gang.chen@asianux.com>
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 | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/mm/mremap.c b/mm/mremap.c index 91b13d6a16d4..0843feb66f3d 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
26 | #include <asm/cacheflush.h> | 26 | #include <asm/cacheflush.h> |
27 | #include <asm/tlbflush.h> | 27 | #include <asm/tlbflush.h> |
28 | #include <asm/pgalloc.h> | ||
29 | 28 | ||
30 | #include "internal.h" | 29 | #include "internal.h" |
31 | 30 | ||
@@ -63,10 +62,8 @@ static pmd_t *alloc_new_pmd(struct mm_struct *mm, struct vm_area_struct *vma, | |||
63 | return NULL; | 62 | return NULL; |
64 | 63 | ||
65 | pmd = pmd_alloc(mm, pud, addr); | 64 | pmd = pmd_alloc(mm, pud, addr); |
66 | if (!pmd) { | 65 | if (!pmd) |
67 | pud_free(mm, pud); | ||
68 | return NULL; | 66 | return NULL; |
69 | } | ||
70 | 67 | ||
71 | VM_BUG_ON(pmd_trans_huge(*pmd)); | 68 | VM_BUG_ON(pmd_trans_huge(*pmd)); |
72 | 69 | ||