提交 7124f1ac 编写于 作者: Y Yang Shi 提交者: Caspar Zhang

mm: unmap VM_PFNMAP mappings with optimized path

to #28718400

commit cb4922496ae40a775a1b17025eaa1060e8991253 upstream.

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.comSigned-off-by: NYang Shi <yang.shi@linux.alibaba.com>
Reviewed-by: NMatthew Wilcox <willy@infradead.org>
Acked-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: NVlastimil Babka <vbabka@suse.cz>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NXu Yu <xuyu@linux.alibaba.com>
Reviewed-by: NYang Shi <yang.shi@linux.alibaba.com>
上级 435ce551
......@@ -2775,15 +2775,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;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册