mm: unmap VM_HUGETLB mappings with optimized path
authorYang Shi <yang.shi@linux.alibaba.com>
Fri, 26 Oct 2018 22:07:15 +0000 (15:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Oct 2018 23:26:33 +0000 (16:26 -0700)
When unmapping VM_HUGETLB mappings, vm flags need to be updated.  Since
the vmas have been detached, so it sounds safe to update vm flags with
read mmap_sem.

Link: http://lkml.kernel.org/r/1537376621-51150-3-git-send-email-yang.shi@linux.alibaba.com
Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
Reviewed-by: Matthew Wilcox <willy@infradead.org>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmap.c

index 330f12c17fa11d835afd80a17e7980f62e707637..ea3188bcc9b46334831d267505976448e90df047 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2777,7 +2777,7 @@ static int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
                         * update vm_flags.
                         */
                        if (downgrade &&
-                           (tmp->vm_flags & (VM_HUGETLB | VM_PFNMAP)))
+                           (tmp->vm_flags & VM_PFNMAP))
                                downgrade = false;
 
                        tmp = tmp->vm_next;