From 4e608926b0dac9a9e5a23f9c2a236c7c7588a885 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Thu, 22 Oct 2015 09:03:46 +1100 Subject: [PATCH] mm: remove lock validation check for MADV_FREE Currently, madvise_free_pte_range is called only madvise path which already holds an mmap_sem so it's pointless to add the lock validation check. Signed-off-by: Minchan Kim Cc: Michal Hocko Signed-off-by: Andrew Morton --- mm/madvise.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/mm/madvise.c b/mm/madvise.c index a9ca6d2fd220..77f4611c98a8 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -274,18 +274,9 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, next = pmd_addr_end(addr, end); if (pmd_trans_huge(*pmd)) { - if (next - addr != HPAGE_PMD_SIZE) { -#ifdef CONFIG_DEBUG_VM - if (!rwsem_is_locked(&mm->mmap_sem)) { - pr_err("%s: mmap_sem is unlocked! addr=0x%lx end=0x%lx vma->vm_start=0x%lx vma->vm_end=0x%lx\n", - __func__, addr, end, - vma->vm_start, - vma->vm_end); - BUG(); - } -#endif + if (next - addr != HPAGE_PMD_SIZE) split_huge_pmd(vma, addr, pmd); - } else if (!madvise_free_huge_pmd(tlb, vma, pmd, addr)) + else if (!madvise_free_huge_pmd(tlb, vma, pmd, addr)) goto next; /* fall through */ } -- 2.39.5