Re: [RFC 2/7] mm/vmalloc: Support non-blocking GFP flags in alloc_vmap_area()

Michal Hocko
2025-07-08T15:17:40Z

On Tue 08-07-25 14:34:28, Uladzislau Rezki wrote:
> On Mon, Jul 07, 2025 at 09:11:35AM +0200, Michal Hocko wrote:
> > On Fri 04-07-25 17:25:32, Uladzislau Rezki wrote:
> > [...]
> > > @@ -2030,7 +2033,8 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
> > > */
> > > va = node_alloc(size, align, vstart, vend, &addr, &vn_id);
> > > if (!va) {
> > > - gfp_mask = gfp_mask & GFP_RECLAIM_MASK;
> > > + if (allow_block)
> > > + gfp_mask = gfp_mask & GFP_RECLAIM_MASK;
> >
> > I don't follow here and is this even correct?
> >
> Allow nested flags to follow a user request if there is a request
> to not block. For example if we apply GFP_RECLAIM_MASK to GFP_ATOMIC
> GFP_ATOMIC is converted to zero, thus to GFP_NOWAIT.

I still do not follow. The aim of this code is to filter out all
non-reclaim related flags. Why that should work differently for
non-waiting allocations?
Btw. if you had GPP_ATOMIC the resulting mask will be still GFP_ATOMIC
as both __GFP_HIGH|__GFP_KSWAPD_RECLAIM are part of GFP_RECLAIM_MASK.

--
Michal Hocko
SUSE Labs