From: Vlastimil Babka <vbabka@suse.cz>
To: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>,
linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <jackmanb@google.com>,
Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
Mel Gorman <mgorman@techsingularity.net>,
kernel-dev@igalia.com, Helen Koike <koike@igalia.com>,
Matthew Wilcox <willy@infradead.org>,
Thierry Reding <thierry.reding@gmail.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
neil@brown.name
Subject: Re: [PATCH] mm/page_alloc: only set ALLOC_HIGHATOMIC for __GPF_HIGH allocations
Date: Fri, 29 Aug 2025 10:38:24 +0200 [thread overview]
Message-ID: <77058118-b481-4c45-8f86-d9a67ea6a187@suse.cz> (raw)
In-Reply-To: <10cdada2-f28f-4868-b821-4a13ed627e76@suse.cz>
On 8/29/25 10:36, Vlastimil Babka wrote:
> On 8/14/25 19:22, Thadeu Lima de Souza Cascardo wrote:
>> Commit 524c48072e56 ("mm/page_alloc: rename ALLOC_HIGH to
>> ALLOC_MIN_RESERVE") is the start of a series that explains how __GFP_HIGH,
>> which implies ALLOC_MIN_RESERVE, is going to be used instead of
>> __GFP_ATOMIC for high atomic reserves.
>>
>> Commit eb2e2b425c69 ("mm/page_alloc: explicitly record high-order atomic
>> allocations in alloc_flags") introduced ALLOC_HIGHATOMIC for such
>> allocations of order higher than 0. It still used __GFP_ATOMIC, though.
>>
>> Then, commit 1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH
>> non-blocking allocations accesses reserves") just turned that check for
>> !__GFP_DIRECT_RECLAIM, ignoring that high atomic reserves were expected to
>> test for __GFP_HIGH.
>>
>> This leads to high atomic reserves being added for high-order GFP_NOWAIT
>> allocations and others that clear __GFP_DIRECT_RECLAIM, which is
>> unexpected. Later, those reserves lead to 0-order allocations going to the
>> slow path and starting reclaim.
>>
>> From /proc/pagetypeinfo, without the patch:
>>
>> Node 0, zone DMA, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0
>> Node 0, zone DMA32, type HighAtomic 1 8 10 9 7 3 0 0 0 0 0
>> Node 0, zone Normal, type HighAtomic 64 20 12 5 0 0 0 0 0 0 0
>>
>> With the patch:
>>
>> Node 0, zone DMA, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0
>> Node 0, zone DMA32, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0
>> Node 0, zone Normal, type HighAtomic 0 0 0 0 0 0 0 0 0 0 0
>>
>> Fixes: 1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH non-blocking allocations accesses reserves")
>> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
>> Tested-by: Helen Koike <koike@igalia.com>
>> Cc: Mel Gorman <mgorman@techsingularity.net>
>> Cc: Michal Hocko <mhocko@suse.com>
>> Cc: Matthew Wilcox <willy@infradead.org>
>> Cc: NeilBrown <neilb@suse.de>
>> Cc: Thierry Reding <thierry.reding@gmail.com>
>> Cc: Vlastimil Babka <vbabka@suse.cz>
>
> Agreed with others that this change matches the original intention and it
> must have been an oversight. Also found nothing to the contrary in the
> original threads.
Oops, forgot to add
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
>> ---
>> mm/page_alloc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 2ef3c07266b3..bf52e3bef626 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -4219,7 +4219,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order)
>> if (!(gfp_mask & __GFP_NOMEMALLOC)) {
>> alloc_flags |= ALLOC_NON_BLOCK;
>>
>> - if (order > 0)
>> + if (order > 0 && (alloc_flags & ALLOC_MIN_RESERVE))
>> alloc_flags |= ALLOC_HIGHATOMIC;
>> }
>>
>
next prev parent reply other threads:[~2025-08-29 8:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 17:22 Thadeu Lima de Souza Cascardo
2025-08-14 20:12 ` Johannes Weiner
2025-08-14 20:34 ` Thadeu Lima de Souza Cascardo
2025-08-28 5:06 ` Sergey Senozhatsky
2025-08-29 6:41 ` Michal Hocko
2025-08-29 8:36 ` Vlastimil Babka
2025-08-29 8:38 ` Vlastimil Babka [this message]
2025-08-29 8:56 ` Sergey Senozhatsky
2025-08-29 9:30 ` Vlastimil Babka
2025-08-29 10:30 ` Thadeu Lima de Souza Cascardo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=77058118-b481-4c45-8f86-d9a67ea6a187@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=cascardo@igalia.com \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=kernel-dev@igalia.com \
--cc=koike@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=neil@brown.name \
--cc=senozhatsky@chromium.org \
--cc=surenb@google.com \
--cc=thierry.reding@gmail.com \
--cc=willy@infradead.org \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox