From: Kiryl Shutsemau <kirill@shutemov.name>
To: Usama Arif <usama.arif@linux.dev>
Cc: 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>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <brendan.jackman@linux.dev>,
Zi Yan <ziy@nvidia.com>, Shakeel Butt <shakeel.butt@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH v2] mm: page_alloc: make defrag_mode retries follow the promoted order
Date: Fri, 9 Oct 2026 13:50:05 +0100 [thread overview]
Message-ID: <asjivmGzSIqTzTXB@thinkstation> (raw)
In-Reply-To: <20261007155316.2010164-1-usama.arif@linux.dev>
On Wed, Oct 07, 2026 at 08:53:14AM -0700, Usama Arif wrote:
> > @@ -5007,14 +5034,20 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
> > * of free memory (see __compaction_suitable)
> > */
> > if (did_some_progress > 0 && can_compact &&
> > - should_compact_retry(gfp_mask, ac, order, alloc_flags,
> > - compact_result, &compact_priority,
> > + should_compact_retry(gfp_mask, ac, order, reclaim_order,
> > + alloc_flags, compact_result, &compact_priority,
> > &compaction_retries))
> > goto retry;
> >
> > - /* Reclaim/compaction failed to prevent the fallback */
> > + /*
> > + * Reclaim/compaction failed to prevent the fallback. The retry
> > + * budget was spent on making blocks, not on the request itself;
> > + * give the fallback a fresh one before considering OOM.
> > + */
> > if (defrag_mode && (alloc_flags & ALLOC_NOFRAGMENT)) {
> > alloc_flags &= ~ALLOC_NOFRAGMENT;
> > + no_progress_loops = 0;
> > + compaction_retries = 0;
>
> Should these counters be reset only when the work order was actually
> promoted?
>
> For movable requests, and requests already at or above pageblock
> order, `reclaim_order == order`. Their retry budget was therefore
> spent on the request itself rather than on promoted pageblock
> production. Resetting the counters here can give those requests
> another 17 no-progress reclaim attempts, plus additional
> compaction-success retries, before OOM or allocation failure.
>
> How about:
> if (reclaim_order != order) {
> no_progress_loops = 0;
> compaction_retries = 0;
> }
>
> instead?
Fair enough.
A movable request only gets here after 16 rounds without progress at its
own order, so the reset would just delay the OOM kill.
Will restrict it to reclaim_order != order in v3.
--
Kiryl Shutsemau / Kirill A. Shutemov
prev parent reply other threads:[~2026-10-09 12:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 9:18 [PATCH v2] mm: page_alloc: make defrag_mode retries follow the promoted order Kiryl Shutsemau
2026-10-06 23:41 ` Andrew Morton
2026-10-07 13:01 ` Kiryl Shutsemau
2026-10-07 18:32 ` Andrew Morton
2026-10-07 15:53 ` Usama Arif
2026-10-09 12:50 ` Kiryl Shutsemau [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=asjivmGzSIqTzTXB@thinkstation \
--to=kirill@shutemov.name \
--cc=akpm@linux-foundation.org \
--cc=brendan.jackman@linux.dev \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=harry@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=shakeel.butt@linux.dev \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.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