[PATCH] mm, vmalloc: fix high order __GFP_NOFAIL allocations

From: Michal Hocko
Date: Mon Mar 06 2023 - 09:03:20 EST


On Mon 06-03-23 13:14:43, Uladzislau Rezki wrote:
[...]
> Some questions:
>
> 1. Could you please add a comment why you want the bulk_gfp without
> the __GFP_NOFAIL(bulk path)?

The bulk allocator is not documented to fully support __GFP_NOFAIL
semantic IIRC. While it uses alloc_pages as fallback I didn't want
to make any assumptions based on the current implementation. At least
that is my recollection. If we do want to support NOFAIL by the batch
allocator then we can drop the special casing here.

> 2. Could you please add a comment why a high order pages do not want
> __GFP_NOFAIL? You have already explained.

See below
> 3. Looking at the patch:
>
> <snip>
> + } else {
> + alloc_gfp &= ~__GFP_NOFAIL;
> + nofail = true;
> <snip>
>
> if user does not want to go with __GFP_NOFAIL flag why you force it in
> case a high order allocation fails and you switch to 0 order allocations?

Not intended. The above should have been else if (gfp & __GFP_NOFAIL).
Thanks for catching that!

This would be the full patch with the description:
---