kernel/fork: Use maple tree for dup_mmap() during forking
The maple tree was already tracking VMAs in this function by an earlier
commit, but the rbtree iterator was being used to iterate the list.
Change the iterator to use a maple tree native iterator, rcu locking,
and switch to the maple tree advanced API to avoid multiple walks of the
tree during insert operations.
anon_vma_fork() may enter the slow path and cause a schedule() call to
cause rcu issues. Drop the rcu lock and reacquiring the lock. There is
no harm in this approach as the mmap_sem is taken for write/read and
held across the schedule() call so the VMAs will not change.
Note that the bulk allocation of nodes is also happening here for
performance reasons. The node calculations are done internally to the
tree and use the VMA count and assume the worst-case node requirements.
The VM_DONT_COPY flag does not allow for the most efficient copy method
of the tree and so a bulk loading algorithm is used.
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>