]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/mmap: Reorganize munmap to use maple states
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 19 Nov 2020 17:57:23 +0000 (12:57 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 16 Dec 2021 03:01:34 +0000 (22:01 -0500)
commit1f0420b44db25e01c15d008acb1fe8442c86931e
treecc36ca721554cc27aae14ce39202128713f27a90
parente0be59ef3163d692c36fae0315856ca3438065e3
mm/mmap: Reorganize munmap to use maple states

Remove __do_munmap() in favour of do_munmap(), do_mas_munmap(), and
do_mas_align_munmap().

do_munmap() is a wrapper to create a maple state for any callers that
have not been converted to the maple tree.

do_mas_munmap() takes a maple state to mumap a range.  This is just a
small function which checks for error conditions and aligns the end of
the range.

do_mas_align_munmap() uses the aligned range to mumap a range.
do_mas_align_munmap() starts with the first VMA in the range, then finds
the last VMA in the range.  Both start and end are split if necessary.
Then the VMAs are unlocked and removed from the linked list at the same
time.  Followed by a single tree operation of overwriting the area in
with a NULL.  Finally, the detached list is unmapped and freed.

By reorganizing the munmap calls as outlined, it is now possible to
avoid extra work of aligning pre-aligned callers which are known to be
safe, avoid extra VMA lookups or tree walks for modifications.

detach_vmas_to_be_unmapped() is no longer used, so drop this code.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
include/linux/mm.h
mm/mmap.c
mm/mremap.c