From: David Rientjes <rientjes@google.com>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <jackmanb@google.com>,
Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] mm, page_alloc: reintroduce page allocation stall warning
Date: Mon, 23 Mar 2026 18:06:52 -0700 (PDT) [thread overview]
Message-ID: <cc53ff01-50b5-dcee-ec2d-29ca0e9baa05@google.com> (raw)
In-Reply-To: <c635acc2-d41b-4f7d-8244-75a117721da3@kernel.org>
On Mon, 23 Mar 2026, Vlastimil Babka (SUSE) wrote:
> On 3/22/26 4:03 AM, David Rientjes wrote:
> > Previously, we had warnings when a single page allocation took longer
> > than reasonably expected. This was introduced in commit 63f53dea0c98
> > ("mm: warn about allocations which stall for too long").
> >
> > The warning was subsequently reverted in commit 400e22499dd9 ("mm: don't
> > warn about allocations which stall for too long") but for reasons
> > unrelated to the warning itself.
> >
> > Page allocation stalls in excess of 10 seconds are always useful to debug
> > because they can result in severe userspace unresponsiveness. Adding
> > this artifact can be used to correlate with userspace going out to lunch
> > and to understand the state of memory at the time.
> >
> > There should be a reasonable expectation that this warning will never
> > trigger given it is very passive, it starts with a 10 second floor to
> > begin with. If it does trigger, this reveals an issue that should be
> > fixed: a single page allocation should never loop for more than 10
> > seconds without oom killing to make memory available.
> >
> > Unlike the original implementation, this implementation only reports
> > stalls that are at least a second longer than the longest stall reported
> > thus far.
> >
> > Signed-off-by: David Rientjes <rientjes@google.com>
>
> I think, why not, if it's useful and we can reintroduce it without the
> issues it had.
> Maybe instead of requiring the stall time to increase by a second, we
> could just limit the stall reports to once per 10 second. If there are
> multiple ones in progress, one of them will win that report slot
> randomly. This would also cover a stall that's so long it reports itself
> multiple times (as in the original commit).
>
I like that a lot, thanks. Since part of the motivation is to correlate
userspace unresponsiveness with page allocation stalls in the kernel, we
increasingly lack that visiblity if a single long page allocation took 60
seconds a month ago, for example, and we have to reach that threshold to
report again.
The original patch ended up at line 4839 here:
4833) }
4834) }
4835)
4836) /* Caller is not willing to reclaim, we can't balance anything */
4837) if (!can_direct_reclaim)
4838) goto nopage;
4839) <===== HERE
4840) /* Avoid recursion of direct reclaim */
4841) if (current->flags & PF_MEMALLOC)
4842) goto nopage;
4843)
4844) /* Try direct reclaim and then allocating */
Which looks like the right place to put it, but probably after the
PF_MEMALLOC check.
If we set a minimum reporting threshold of 10 seconds and only report
system wide every 10 seconds, I think this will work very well. And, as
you mention, this also reports stalls for allocations that never actually
return.
I'll implement this and send out a formal patch for it.
next prev parent reply other threads:[~2026-03-24 1:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 3:03 [RFC] mm, page_alloc: reintroduce page allocation stall warning David Rientjes
2026-03-22 20:28 ` David Rientjes
2026-03-23 14:24 ` Vlastimil Babka (SUSE)
2026-03-24 1:06 ` David Rientjes [this message]
2026-03-23 16:53 ` Michal Hocko
2026-03-24 1:13 ` David Rientjes
2026-03-24 8:05 ` Petr Mladek
2026-03-23 19:05 ` Andrew Morton
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=cc53ff01-50b5-dcee-ec2d-29ca0e9baa05@google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=surenb@google.com \
--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