mm: unmap VM_PFNMAP mappings with optimized path

When unmapping VM_PFNMAP 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-4-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>
This commit is contained in:
Yang Shi 2018-10-26 15:07:18 -07:00 committed by Linus Torvalds
parent b4cefb3605
commit cb4922496a
1 changed files with 0 additions and 9 deletions

View File

@ -2771,15 +2771,6 @@ static int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
munlock_vma_pages_all(tmp);
}
/*
* Unmapping vmas, which have VM_HUGETLB or VM_PFNMAP,
* need get done with write mmap_sem held since they may
* update vm_flags.
*/
if (downgrade &&
(tmp->vm_flags & VM_PFNMAP))
downgrade = false;
tmp = tmp->vm_next;
}
}