aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2016-05-19 20:12:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-19 22:12:14 -0400
commitbf8616d5fa179d6c755f06726567c6d63c6fbbc7 (patch)
treee9bb568bea162e3f66da723d09d21449638b3878
parent52b6f46bc163eef17ecba4cd552beeafe2b24453 (diff)
huge mm: move_huge_pmd does not need new_vma
Remove move_huge_pmd()'s redundant new_vma arg: all it was used for was a VM_NOHUGEPAGE check on new_vma flags, but the new_vma is cloned from the old vma, so a trans_huge_pmd in the new_vma will be as acceptable as it was in the old vma, alignment and size permitting. Signed-off-by: Hugh Dickins <hughd@google.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Andres Lagar-Cavilla <andreslc@google.com> Cc: Yang Shi <yang.shi@linaro.org> Cc: Ning Qu <quning@gmail.com> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Andres Lagar-Cavilla <andreslc@google.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/huge_mm.h4
-rw-r--r--mm/huge_memory.c7
-rw-r--r--mm/mremap.c5
3 files changed, 5 insertions, 11 deletions
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index d7b9e5346fba..419fb9e03447 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -28,9 +28,7 @@ extern int zap_huge_pmd(struct mmu_gather *tlb,
28extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 28extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
29 unsigned long addr, unsigned long end, 29 unsigned long addr, unsigned long end,
30 unsigned char *vec); 30 unsigned char *vec);
31extern bool move_huge_pmd(struct vm_area_struct *vma, 31extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
32 struct vm_area_struct *new_vma,
33 unsigned long old_addr,
34 unsigned long new_addr, unsigned long old_end, 32 unsigned long new_addr, unsigned long old_end,
35 pmd_t *old_pmd, pmd_t *new_pmd); 33 pmd_t *old_pmd, pmd_t *new_pmd);
36extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 34extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index f8ac8f582fd8..66675eed67be 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1698,20 +1698,17 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
1698 return 1; 1698 return 1;
1699} 1699}
1700 1700
1701bool move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma, 1701bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
1702 unsigned long old_addr,
1703 unsigned long new_addr, unsigned long old_end, 1702 unsigned long new_addr, unsigned long old_end,
1704 pmd_t *old_pmd, pmd_t *new_pmd) 1703 pmd_t *old_pmd, pmd_t *new_pmd)
1705{ 1704{
1706 spinlock_t *old_ptl, *new_ptl; 1705 spinlock_t *old_ptl, *new_ptl;
1707 pmd_t pmd; 1706 pmd_t pmd;
1708
1709 struct mm_struct *mm = vma->vm_mm; 1707 struct mm_struct *mm = vma->vm_mm;
1710 1708
1711 if ((old_addr & ~HPAGE_PMD_MASK) || 1709 if ((old_addr & ~HPAGE_PMD_MASK) ||
1712 (new_addr & ~HPAGE_PMD_MASK) || 1710 (new_addr & ~HPAGE_PMD_MASK) ||
1713 old_end - old_addr < HPAGE_PMD_SIZE || 1711 old_end - old_addr < HPAGE_PMD_SIZE)
1714 (new_vma->vm_flags & VM_NOHUGEPAGE))
1715 return false; 1712 return false;
1716 1713
1717 /* 1714 /*
diff --git a/mm/mremap.c b/mm/mremap.c
index 3fa0a467df66..7d98fe1adc12 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -198,9 +198,8 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
198 /* See comment in move_ptes() */ 198 /* See comment in move_ptes() */
199 if (need_rmap_locks) 199 if (need_rmap_locks)
200 anon_vma_lock_write(vma->anon_vma); 200 anon_vma_lock_write(vma->anon_vma);
201 moved = move_huge_pmd(vma, new_vma, old_addr, 201 moved = move_huge_pmd(vma, old_addr, new_addr,
202 new_addr, old_end, 202 old_end, old_pmd, new_pmd);
203 old_pmd, new_pmd);
204 if (need_rmap_locks) 203 if (need_rmap_locks)
205 anon_vma_unlock_write(vma->anon_vma); 204 anon_vma_unlock_write(vma->anon_vma);
206 if (moved) { 205 if (moved) {