Re: [PATCH RFC 00/12] mm/vmalloc: migrate vmap_area indexing from rb-tree to maple-tree

From: Matthew Wilcox

Date: Fri Jun 26 2026 - 10:19:33 EST


On Fri, Jun 26, 2026 at 04:17:08PM +0530, Pranjal Arya wrote:
> I am planning to have following approach on this:
>
> 1. mas_preallocate(GFP_NOWAIT | __GFP_NOWARN) + mas_store_prealloc
> will be fast path. The preallocate attempt will be non sleeping and,
> if it succeeds, the subsequent store won't require allocation.
>
> 2. mas_store_gfp(GFP_ATOMIC | __GFP_NOWARN) fallback: if
> preallocate fails (rare but possible under memory pressure),
> GFP_ATOMIC will make a non sleeping allocation attempt inline.

This isn't how you're supposed to use the maple tree. The intent is
that it's protected by its internal spinlock, and so it can drop the
lock to allocate memory if it needs to in order to balance the tree.

If the user needs to also use that spinlock to protect other things,
that's allowed.