From: Johannes Weiner <hannes@cmpxchg.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Mel Gorman <mgorman@techsingularity.net>,
Michal Hocko <mhocko@suse.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com
Subject: Re: [PATCH 2/5] mm: compaction: simplify should_compact_retry()
Date: Mon, 29 May 2023 12:38:05 -0400 [thread overview]
Message-ID: <20230529163805.GA84971@cmpxchg.org> (raw)
In-Reply-To: <1c3c9305-a678-279e-f015-7aed544ab3c8@suse.cz>
On Mon, May 29, 2023 at 03:03:52PM +0200, Vlastimil Babka wrote:
> On 5/19/23 14:39, Johannes Weiner wrote:
> > The different branches for retry are unnecessarily complicated. There
> > are really only three outcomes: progress (retry n times), skipped
> > (retry if reclaim can help), failed (retry with higher priority).
> >
> > Rearrange the branches and the retry counter to make it simpler.
> >
> > v2:
> > - fix trace point build (Mel)
> > - fix max_retries logic for costly allocs (Huang)
> >
> > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> > ---
> > mm/page_alloc.c | 53 +++++++++++++++----------------------------------
> > 1 file changed, 16 insertions(+), 37 deletions(-)
> >
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 5a84a0bebc37..72660e924b95 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -3772,16 +3772,22 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
> > * Compaction managed to coalesce some page blocks, but the
> > * allocation failed presumably due to a race. Retry some.
> > */
> > - if (compact_result == COMPACT_SUCCESS)
> > - (*compaction_retries)++;
> > + if (compact_result == COMPACT_SUCCESS) {
> > + /*
> > + * !costly requests are much more important than
> > + * __GFP_RETRY_MAYFAIL costly ones because they are de
> > + * facto nofail and invoke OOM killer to move on while
> > + * costly can fail and users are ready to cope with
> > + * that. 1/4 retries is rather arbitrary but we would
> > + * need much more detailed feedback from compaction to
> > + * make a better decision.
> > + */
> > + if (order > PAGE_ALLOC_COSTLY_ORDER)
> > + max_retries /= 4;
> >
> > - /*
> > - * All zones were scanned completely and still no result. It
> > - * doesn't really make much sense to retry except when the
> > - * failure could be caused by insufficient priority
> > - */
> > - if (compact_result == COMPACT_COMPLETE)
> > - goto check_priority;
> > + ret = ++(*compaction_retries) <= max_retries;
> > + goto out;
>
> I think you simplified this part too much, so now once it runs out of
> retries, it will return false, while previously it would increase the priority.
Oops, I'll send a delta fix to Andrew tomorrow. Thanks!
next prev parent reply other threads:[~2023-05-29 16:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-19 12:39 [PATCH 0/5] mm: compaction: cleanups & simplifications Johannes Weiner
2023-05-19 12:39 ` [PATCH 1/5] mm: compaction: remove compaction result helpers Johannes Weiner
2023-05-29 9:58 ` Vlastimil Babka
2023-05-19 12:39 ` [PATCH 2/5] mm: compaction: simplify should_compact_retry() Johannes Weiner
2023-05-29 13:03 ` Vlastimil Babka
2023-05-29 16:38 ` Johannes Weiner [this message]
2023-05-19 12:39 ` [PATCH 3/5] mm: compaction: refactor __compaction_suitable() Johannes Weiner
2023-05-29 17:11 ` Vlastimil Babka
2023-05-19 12:39 ` [PATCH 4/5] mm: compaction: remove unnecessary is_via_compact_memory() checks Johannes Weiner
2023-05-29 17:12 ` Vlastimil Babka
2023-05-19 12:39 ` [PATCH 5/5] mm: compaction: drop redundant watermark check in compaction_zonelist_suitable() Johannes Weiner
2023-05-29 17:12 ` Vlastimil Babka
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=20230529163805.GA84971@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=vbabka@suse.cz \
/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