]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/mmap: change do_brk_flags() to expand existing VMA and add do_brk_munmap()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Wed, 20 Jul 2022 02:17:50 +0000 (02:17 +0000)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 6 Sep 2022 19:44:22 +0000 (15:44 -0400)
commitec7798f0fbaf6a06711097141ea38f471b54d765
tree8803f28ee757ddbf12599cceb56ac3ebfdfcc571
parent40f4be06119abe10d29fbb06c20fa2c3ac14c1fc
mm/mmap: change do_brk_flags() to expand existing VMA and add do_brk_munmap()

Avoid allocating a new VMA when it a vma modification can occur.  When a
brk() can expand or contract a VMA, then the single store operation will
only modify one index of the maple tree instead of causing a node to split
or coalesce.  This avoids unnecessary allocations/frees of maple tree
nodes and VMAs.

Move some limit & flag verifications out of the do_brk_flags() function to
use only relevant checks in the code path of bkr() and vm_brk_flags().

Set the vma to check if it can expand in vm_brk_flags() if extra criteria
are met.

Drop userfaultfd from do_brk_flags() path and only use it in
vm_brk_flags() path since that is the only place a munmap will happen.

Add a wraper for munmap for the brk case called do_brk_munmap().

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