mm/mmap: convert all mas except mas_detach to vma iterator
authorYajun Deng <yajun.deng@linux.dev>
Mon, 25 Mar 2024 06:32:58 +0000 (14:32 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Apr 2024 03:56:11 +0000 (20:56 -0700)
commitd4e6b397be1b403991a028ea59dbe61dedc9bcc0
treed6c4e778630fad4785256e3845228d0b4ea023c4
parent0b52663f7547520fbf54e2c07f61f8bd1b5cb6eb
mm/mmap: convert all mas except mas_detach to vma iterator

There are two types of iterators mas and vmi in the current code.  If the
maple tree comes from the mm structure, we can use the vma iterator.
Avoid using mas directly as possible.

Keep using mas for the mt_detach tree, since it doesn't come from the mm
structure.

Remove as many uses of mas as possible, but we will still have a few that
must be passed through in unmap_vmas() and free_pgtables().

Also introduce vma_iter_reset, vma_iter_{prev, next}_range_limit and
vma_iter_area_{lowest, highest} helper functions for using the vma
interator.

Link: https://lkml.kernel.org/r/20240325063258.1437618-1-yajun.deng@linux.dev
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Tested-by: Helge Deller <deller@gmx.de> [parisc]
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/internal.h
mm/mmap.c