From b4cefb36051244bcb5651026d862c332a6cac7df Mon Sep 17 00:00:00 2001 From: Yang Shi Date: Fri, 26 Oct 2018 15:07:15 -0700 Subject: mm: unmap VM_HUGETLB mappings with optimized path 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 Reviewed-by: Matthew Wilcox Acked-by: Kirill A. Shutemov Acked-by: Vlastimil Babka Cc: Michal Hocko Cc: Vlastimil Babka Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index 330f12c17fa1..ea3188bcc9b4 100644 --- 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; -- cgit v1.2.3