]> 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, 2 Sep 2021 15:26:26 +0000 (11:26 -0400)
commit6cf58749481b25301f55eefda3cd65856c3903b6
tree1e39a7f2e235b7df0941e5cffb755a61b67d3099
parent3e29ffcc355e2fd18db836919fc8c314aca2c153
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