Re: [PATCH v2 04/13] mm/page_alloc: relax GFP WARN in nolock allocs

From: Suren Baghdasaryan

Date: Wed Jun 24 2026 - 12:06:11 EST


On Mon, Jun 22, 2026 at 3:01 AM Brendan Jackman <jackmanb@xxxxxxxxxx> wrote:
>
> This WARN forbids setting other flags than __GFP_ACCOUNT but we
> unconditionally set the ones in gfp_nolock so they are certainly fine
> for the caller to set.
>
> There are other GFP flags that are almost certainly fine to set here;
> Willy noted GFP_HIGHMEM, GFP_DMA, GFP_MOVABLE and GFP_HARDWALL. But,
> nolock allocation is rather special, so be conservative to try and
> ensure we have a chance to think carefully before nontrivial new
> usecases arise.
>
> Suggested-by: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> Link: https://lore.kernel.org/linux-mm/ajS96fWbG4dzP3u3@xxxxxxxxxxxxxxxxxxxx/
> Signed-off-by: Brendan Jackman <jackmanb@xxxxxxxxxx>

Reviewed-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>

> ---
> mm/page_alloc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index e31babe2181a1..074e007bf1bc3 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5337,7 +5337,8 @@ struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
> return NULL;
>
> if (alloc_flags & ALLOC_NOLOCK) {
> - VM_WARN_ON_ONCE(gfp & ~__GFP_ACCOUNT);
> + /* Certain other flags could be supported later if needed. */
> + VM_WARN_ON_ONCE(gfp & ~(__GFP_ACCOUNT | gfp_nolock));
> if (!alloc_trylock_allowed())
> return NULL;
> gfp |= gfp_nolock;
>
> --
> 2.54.0
>