From: Michal Hocko <mhocko@suse.com>
To: Yosry Ahmed <yosry@kernel.org>
Cc: Charan Teja Kalla <quic_charante@quicinc.com>,
akpm@linux-foundation.org, mgorman@techsingularity.net,
david@redhat.com, vbabka@suse.cz, hannes@cmpxchg.org,
quic_pkondeti@quicinc.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V3 3/3] mm: page_alloc: drain pcp lists before oom kill
Date: Mon, 7 Sep 2026 09:26:30 +0200 [thread overview]
Message-ID: <ap5nJm1mH-4nfLaY@tiehlicka> (raw)
In-Reply-To: <CAO9r8zO93CMjJHLO1ZqHY0Tr2kDfvpMHfH3MLkR37vV0YROf_g@mail.gmail.com>
On Fri 04-09-26 09:35:55, Yosry Ahmed wrote:
> On Fri, Sep 4, 2026 at 9:27 AM Michal Hocko <mhocko@suse.com> wrote:
[...]
> > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > > index 8d79f76cdd0e1..98e9079240ad5 100644
> > > --- a/mm/page_alloc.c
> > > +++ b/mm/page_alloc.c
> > > @@ -4592,11 +4592,12 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask,
> > > unsigned int order,
> > > psi_memstall_enter(&pflags);
> > > *did_some_progress = __perform_reclaim(gfp_mask, order, ac);
> > > if (unlikely(!(*did_some_progress)))
> > > - goto out;
> > > + goto drain;
> > >
> > > retry:
> > > page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac);
> > >
> > > +drain:
> > > /*
> > > * If an allocation failed after direct reclaim, it could be because
> > > * pages are pinned on the per-cpu lists or in high alloc reserves.
> > > @@ -4608,7 +4609,6 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask,
> > > unsigned int order,
> > > drained = true;
> > > goto retry;
> > > }
> > > -out:
> > > psi_memstall_leave(&pflags);
> >
> > Ideally if we can make the function call less hairy. Maybe we want to
> > make draining part of the reclaim as the last resort when normal reclaim
> > fails.
>
> Do you mean do the draining in __perform_reclaim(), or deeper into the
> reclaim stack?
>
> The thing is that __alloc_pages_direct_reclaim() currently drains when
> __perform_reclaim() fails to make any progress and we still cannot
> allocate. The change above makes it drain if it cannot allocate after
> __perform_reclaim(), regardless of progress. So if you want to move it
> into __perform_reclaim(), we'll have it in both places.
>
> Or maybe I just don't understand what you meant :)
Sorry for not being clear enough. I meant to pull draining out of
__alloc_pages_direct_reclaim and instead have it somewhere in the
reclaim path. It is not entirely clear to me where at the moment but we
do not need to have the same behavior as now. The idea behind the code
is to not drain way too much. Maybe we want to drain when dropping the
priority down to 0.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2026-09-07 7:26 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-05 12:50 [PATCH V2 0/3] mm: page_alloc: fixes for early oom kills Charan Teja Kalla
2023-11-05 12:50 ` [PATCH V2 1/3] mm: page_alloc: unreserve highatomic page blocks before oom Charan Teja Kalla
2023-11-09 10:29 ` Michal Hocko
2023-11-05 12:50 ` [PATCH V2 2/3] mm: page_alloc: correct high atomic reserve calculations Charan Teja Kalla
2023-11-16 9:59 ` Mel Gorman
2023-11-16 12:52 ` Michal Hocko
2023-11-17 16:19 ` Mel Gorman
2023-11-05 12:50 ` [PATCH V3 3/3] mm: page_alloc: drain pcp lists before oom kill Charan Teja Kalla
2023-11-05 12:55 ` Charan Teja Kalla
2023-11-09 10:33 ` Michal Hocko
2023-11-10 16:36 ` Charan Teja Kalla
2023-11-14 10:48 ` Michal Hocko
2023-11-14 16:36 ` Charan Teja Kalla
2023-11-15 14:09 ` Michal Hocko
2023-11-16 6:00 ` Charan Teja Kalla
2023-11-16 12:55 ` Michal Hocko
2023-11-17 5:43 ` Charan Teja Kalla
2024-01-25 16:36 ` Zach O'Keefe
2024-01-26 10:47 ` Charan Teja Kalla
2024-01-26 10:57 ` Michal Hocko
2024-01-26 22:51 ` Zach O'Keefe
2024-01-29 15:04 ` Michal Hocko
2024-02-06 23:15 ` Zach O'Keefe
2026-09-02 16:49 ` Yosry Ahmed
2026-09-02 16:56 ` Yosry Ahmed
2026-09-03 7:27 ` Michal Hocko
2026-09-03 14:03 ` Yosry Ahmed
2026-09-04 11:21 ` Michal Hocko
2026-09-04 16:09 ` Yosry Ahmed
2026-09-04 16:27 ` Michal Hocko
2026-09-04 16:35 ` Yosry Ahmed
2026-09-07 7:26 ` Michal Hocko [this message]
2026-09-07 8:49 ` Yosry Ahmed
2026-09-09 7:36 ` Michal Hocko
2026-09-10 7:21 ` Yosry Ahmed
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=ap5nJm1mH-4nfLaY@tiehlicka \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=quic_charante@quicinc.com \
--cc=quic_pkondeti@quicinc.com \
--cc=vbabka@suse.cz \
--cc=yosry@kernel.org \
/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