From: sashiko-bot@kernel.org
To: "Kiryl Shutsemau (Meta)" <kas@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Vlastimil Babka" <vbabka@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"David Hildenbrand" <david@kernel.org>,
"Harry Yoo" <harry@kernel.org>
Cc: "Suren Baghdasaryan" <surenb@google.com>,
"Michal Hocko" <mhocko@suse.com>,
"Brendan Jackman" <brendan.jackman@linux.dev>,
"Zi Yan" <ziy@nvidia.com>, "Lorenzo Stoakes" <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
"Mike Rapoport" <rppt@kernel.org>,
"Qi Zheng" <qi.zheng@linux.dev>,
"Shakeel Butt" <shakeel.butt@linux.dev>,
"Kairui Song" <kasong@tencent.com>,
"Barry Song" <baohua@kernel.org>,
"Axel Rasmussen" <axelrasmussen@google.com>,
"Yuanchu Xie" <yuanchu@google.com>, "Wei Xu" <weixugc@google.com>,
"Baoquan He" <baoquan.he@linux.dev>,
"Baolin Wang" <baolin.wang@linux.alibaba.com>,
"Dev Jain" <dev.jain@arm.com>,
"Usama Arif" <usama.arif@linux.dev>,
linux-mm@kvack.org, kernel-team@meta.com
Subject: Re: [PATCH v3 2/3] mm: page_alloc: make the high-order watermark check honour ALLOC_NOFRAGMENT
Date: Tue, 17 Nov 2026 12:51:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-218808@kernel.org> (raw)
In-Reply-To: <20261116125103.2894162-3-kas@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mm: page_alloc: should_reclaim_retry() counts unusable
migratetype pages
--
commit 214b943d575d3d5441bd4208e2c27a65d780e75c
Author: Kiryl Shutsemau (Meta) <kas@kernel.org>
mm: page_alloc: make the high-order watermark check honour ALLOC_NOFRAGMENT
This commit makes __zone_watermark_ok_mt() and __compact_finished() ignore
free lists of other migratetypes below pageblock_order when
ALLOC_NOFRAGMENT is set.
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0ebfbbb5d7c57..6e75c03b303b1 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
[ ... ]
> @@ -4693,10 +4705,13 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order,
>
> /*
> * Would the allocation succeed if we reclaimed all
> - * reclaimable pages?
> + * reclaimable pages? Count free pages of all migratetypes.
> + * Compaction can then free a whole pageblock for the
> + * allocation to claim.
> */
> wmark = __zone_watermark_ok(zone, order, min_wmark,
> - ac->highest_zoneidx, alloc_flags, available);
> + ac->highest_zoneidx,
> + alloc_flags & ~ALLOC_NOFRAGMENT, available);
> trace_reclaim_retry_zone(z, order, reclaimable,
> available, min_wmark, *no_progress_loops, wmark);
> if (wmark) {
[Severity: Medium]
Does stripping ALLOC_NOFRAGMENT here cause should_reclaim_retry() to keep
returning true when a free page with order <= o < pageblock_order only
exists on another migratetype's free list?
In __zone_watermark_ok_mt(), the order-0 watermark check against available
already counts free base pages of all migratetypes regardless of
ALLOC_NOFRAGMENT. Clearing ALLOC_NOFRAGMENT instead changes the
z->free_area[o] loop for order > 0 so that it accepts existing high-order
free pages of other migratetypes that the ALLOC_NOFRAGMENT allocation and
compaction now reject.
In __alloc_pages_slowpath(), should_reclaim_retry() runs before
should_compact_retry() and the ALLOC_NOFRAGMENT fallback:
mm/page_alloc.c:__alloc_pages_slowpath() {
...
if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags,
did_some_progress > 0, &no_progress_loops))
goto retry;
if (did_some_progress > 0 && can_compact &&
should_compact_retry(gfp_mask, ac, order, alloc_flags,
compact_result, &compact_priority,
&compaction_retries))
goto retry;
/* Reclaim/compaction failed to prevent the fallback */
if (defrag_mode && (alloc_flags & ALLOC_NOFRAGMENT)) {
alloc_flags &= ~ALLOC_NOFRAGMENT;
...
}
When another migratetype holds a free page of order 1..pageblock_order-1,
this regression makes __alloc_pages_slowpath() jump back to retry before
should_compact_retry() can escalate compact_priority, and traps movable
allocations of order <= PAGE_ALLOC_COSTLY_ORDER in reclaim because
should_reclaim_retry() resets *no_progress_loops to 0 on every reclaim pass
that frees any page.
Calling __zone_watermark_ok_mt(zone, order, min_wmark, ac->highest_zoneidx,
alloc_flags, available, ac->migratetype) here would still count all
migratetypes in the order-0 available check while only accepting usable
high-order free pages, letting the slowpath fall through to
should_compact_retry() when compaction is needed to form a full pageblock.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116125103.2894162-1-kas@kernel.org?part=2
next prev parent reply other threads:[~2026-11-17 12:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 12:50 [PATCH v3 0/3] mm: make watermark checks honour ALLOC_NOFRAGMENT Kiryl Shutsemau (Meta)
2026-11-16 12:50 ` [PATCH v3 1/3] mm: page_alloc: add a watermark check that knows the migratetype Kiryl Shutsemau (Meta)
2026-11-16 12:51 ` [PATCH v3 2/3] mm: page_alloc: make the high-order watermark check honour ALLOC_NOFRAGMENT Kiryl Shutsemau (Meta)
2026-11-17 12:51 ` sashiko-bot [this message]
2026-11-18 8:10 ` Dev Jain
2026-11-16 12:51 ` [PATCH v3 3/3] mm: vmscan: tell direct reclaim the allocation is ALLOC_NOFRAGMENT Kiryl Shutsemau (Meta)
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=sashiko-outbox-218808@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=baoquan.he@linux.dev \
--cc=brendan.jackman@linux.dev \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=harry@kernel.org \
--cc=kas@kernel.org \
--cc=kasong@tencent.com \
--cc=kernel-team@meta.com \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=qi.zheng@linux.dev \
--cc=rppt@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=weixugc@google.com \
--cc=yuanchu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.