munmap does not need to preallocate maple tree nodes. In fact, it
already does allocate maple tree nodes for the side branch as well as
VMAs, so it is safe to do so for the tree. Using the in-tree allocation
allows for a higher chance of better calculation of nodes needed, and
performs better.
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
mt_init_flags(&mt_detach, mas->tree->ma_flags & MT_FLAGS_LOCK_MASK);
mt_set_external_lock(&mt_detach, &mm->mmap_lock);
- if (mas_preallocate(mas, vma, GFP_KERNEL))
- return -ENOMEM;
-
mas->last = end - 1;
/*
* If we need to split any vma, do it now to save pain later.
mas_set_range(mas, start, end - 1);
}
#endif
- mas_store_prealloc(mas, NULL);
+ mas_store_gfp(mas, NULL, GFP_KERNEL);
mm->map_count -= count;
/*
* Do not downgrade mmap_lock if we are next to VM_GROWSDOWN or