Skip to content

Commit

Permalink
mm: unmap VM_PFNMAP mappings with optimized path
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: Yang Shi <[email protected]>
Reviewed-by: Matthew Wilcox <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Yang Shi authored and torvalds committed Oct 26, 2018
1 parent b4cefb3 commit cb49224
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit cb49224

Please sign in to comment.