Re: [PATCH 1/2] mm: page_alloc: do not give all non-blocking requests reserve access

From: Matthew Wilcox

Date: Mon Sep 21 2026 - 12:05:20 EST


On Mon, Sep 21, 2026 at 10:38:18AM -0400, Johannes Weiner wrote:
> +++ b/mm/page_alloc.c
> @@ -3246,7 +3246,9 @@ struct page *rmqueue_buddy(struct zone *preferred_zone, struct zone *zone,
> * reserves as failing now is worse than failing a
> * high-order atomic allocation in the future.
> */
> - if (!page && (alloc_flags & (ALLOC_OOM|ALLOC_NON_BLOCK)))
> + if (!page &&
> + ((alloc_flags & ALLOC_OOM) ||
> + (alloc_flags & ALLOC_MASK_ATOMIC) == ALLOC_MASK_ATOMIC))
> page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);

Would this be slightly neater?

static inline bool may_access_reserves(unsigned int alloc_flags)
{
if (alloc_flags & ALLOC_OOM)
return true;
if (alloc_flags & (ALLOC_NON_BLOCK | ALLOC_MIN_RESERVE)) ==
(ALLOC_NON_BLOCK | ALLOC_MIN_RESERVE)
return true;
return false;
}

[...]

- if (!page && (alloc_flags & (ALLOC_OOM|ALLOC_NON_BLOCK)))
+ if (!page && may_access_reserves(alloc_flags))
page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);