Commit e9fdabfc authored by Liam R. Howlett's avatar Liam R. Howlett Committed by Suren Baghdasaryan
Browse files

FROMLIST: BACKPORT: mm: Change do_vmi_align_munmap() side tree index



The majority of the calls to munmap a VMA is for a single vma.  The
maple tree is able to store a single entry at 0, with a size of 1 as a
pointer and avoid any allocations.  Change do_vmi_align_munmap() to
store the VMAs being munmap()'ed into a tree indexed by the count.  This
will leverage the ability to store the first entry without a node
allocation.

Storing the entries into a tree by the count and not the vma start and
end means changing the functions which iterate over the entries.  Update
unmap_vmas() and free_pgtables() to take a maple state and a tree end
address to support this functionality.

Passing through the same maple state to unmap_vmas() and free_pgtables()
means the state needs to be reset between calls.  This happens in the
static unmap_region() and exit_mmap().

Signed-off-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>

Link: https://lore.kernel.org/lkml/20230601021605.2823123-5-Liam.Howlett@oracle.com/


[surenb: skip changes passing maple state to unmap_vmas() and
free_pgtables()]

Bug: 274059236
Change-Id: If38cfecd51da884bcfdbdfdfbf955a0b338d3d60
Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
parent 25bed2fd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment