From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Dev Jain <dev.jain@arm.com>,
Qi Wu <shijing.wuqi@linux.alibaba.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Andrew Morton <akpm@linux-foundation.org>,
Kiryl Shutsemau <kas@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <brendan.jackman@linux.dev>,
Zi Yan <ziy@nvidia.com>, Mel Gorman <mgorman@techsingularity.net>,
linux-mm@kvack.org
Subject: Re: [PATCH] mm: page_alloc: do not capture HIGHATOMIC pages
Date: Thu, 3 Dec 2026 12:03:04 +0100 [thread overview]
Message-ID: <3eec3d9b-bea3-4deb-ad2d-7ece5b85cf4f@kernel.org> (raw)
In-Reply-To: <2ec15e68-5993-4186-bf0a-198a5630cfe9@arm.com>
On 12/3/26 09:34, Dev Jain wrote:
>
>
> On 29/11/26 7:53 pm, Qi Wu wrote:
>> compaction_capture() filters CMA and isolated pages but not
>> MIGRATE_HIGHATOMIC. A captured page bypasses the buddy freelists, so it
>> escapes the ALLOC_HIGHATOMIC check in rmqueue_buddy() and the
>> nr_free_highatomic watermark accounting: a plain blocking allocation
>> can consume a page reserved for atomic allocations. HIGHATOMIC pages
>> reach the hook through PCP drains, which re-read the pageblock type
>> before calling __free_one_page().
>>
>> The gap has existed since capture was introduced; commit 7e8756d7ad22
>> ("mm: page_alloc: fix non-movable reclaim storm in defrag_mode")
>> widened it by sending non-movable order-0 allocations through direct
>> compaction when defrag_mode is enabled.
>>
>> Refuse HIGHATOMIC pages like CMA. The page then enters the freelists
>> and the allocation falls back to get_page_from_freelist(), where the
>> reserve checks apply.
>>
>> Found and drafted with AI assistance (Qoder); build-tested only.
>>
>> Fixes: 5e1f0f098b46 ("mm, compaction: capture a page under direct compaction")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Qi Wu <shijing.wuqi@linux.alibaba.com>
>> ---
>
> I think the main bug is about policy: IIUC a non-highatomic request currently
> is able to take a highatomic page only via the PCP. Once we are in the
> zone a highatomic page can be taken only by highatomic request.
>
> So with that in mind I think this patch is correct for its scope:
>
> Reviewed-by: Dev Jain <dev.jain@arm.com>
>
> But the bigger question is, compaction_capture() captures a page for an allocation,
> with no context as to who will consume that page. So for example with an
> ALLOC_NOFRAGMENT request, we could mix allocations in pageblocks.
>
> So perhaps there should be a check after looking up capc->page, whether
> this is suitable for our allocation.
Let's CC Kiryl then...
>
>> mm/page_alloc.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 2fef4092c913..4443d715df2d 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -735,6 +735,10 @@ compaction_capture(struct capture_control *capc, struct page *page,
>> is_migrate_isolate(migratetype))
>> return false;
>>
>> + /* HIGHATOMIC pages are reserved for atomic allocations. */
>> + if (migratetype == MIGRATE_HIGHATOMIC)
>> + return false;
>> +
>> /*
>> * Do not let lower order allocations pollute a movable pageblock
>> * unless compaction is also requesting movable pages.
>>
>> base-commit: 4f069ab1ec243e6b60dc438772905855c60774e8
>>
>> Notes (not part of the commit log):
>> - Checked against akpm mm-unstable (890dc639d8a3): compaction_capture()
>> is identical there. The in-flight freetype_t rework and the
>> "claim blocks captured for non-movable use" RFC touch this function
>> but are not queued yet, so this applies cleanly to both trees.
>> - The hit rate of this path can be observed with the
>> mm_page_alloc_extfrag tracepoint (fallbackmt=HIGHATOMIC).
>
prev parent reply other threads:[~2026-12-03 11:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 14:23 [PATCH] mm: page_alloc: do not capture HIGHATOMIC pages Qi Wu
2026-11-30 15:56 ` Harry Yoo
2026-12-02 6:08 ` Qi Wu
2026-12-03 8:34 ` Dev Jain
2026-12-03 11:03 ` Vlastimil Babka (SUSE) [this message]
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=3eec3d9b-bea3-4deb-ad2d-7ece5b85cf4f@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brendan.jackman@linux.dev \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=kas@kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=shijing.wuqi@linux.alibaba.com \
--cc=surenb@google.com \
--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