public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: David Rientjes <rientjes@google.com>
Cc: Michal Hocko <mhocko@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Suren Baghdasaryan <surenb@google.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,
	Steven Rostedt <rostedt@goodmis.org>,
	John Ogness <john.ogness@linutronix.de>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [RFC] mm, page_alloc: reintroduce page allocation stall warning
Date: Tue, 24 Mar 2026 09:05:29 +0100	[thread overview]
Message-ID: <acJFyXIaMspV383t@pathway.suse.cz> (raw)
In-Reply-To: <9c21e9e9-7347-18cc-9dd5-76fad75719dc@google.com>

On Mon 2026-03-23 18:13:21, David Rientjes wrote:
> On Mon, 23 Mar 2026, Michal Hocko wrote:
> 
> > On Sat 21-03-26 20:03:16, 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.
> > 
> > Am all for reintroducing the warning in some shape. The biggest problem
> > back then was printk being too eager to stomp all the work at a single
> > executing context. Not sure this is still the case. Let's add printk
> > maintainers.

printk() is still a constraint. There is an API which allows to
offload printk() into a kthread but only few console drivers have been
converted so far. Most console drivers, including the most common
uart 8250, are still using the legacy loop in
printk()/console_unlock().

In addition, the new API introduced an emergency context which forces
synchronous flush of printk messages even for the converted console
drivers. The emergency context is currently used, for example, by
WARN() or RCU stall report. So, there always will be a risk that
too many pending messages might cause a stall.

> > Also it makes some sense to differentiate stalled callers and show_mem
> > which is more verbose. The former tells us who is affected and the
> > second will give us more context and we want to get some information
> > about all of them. The latter can be printed much less often as it will
> > describe situation for a batch of concurrent ones.
> >
>
> Based on Vlastimil's suggestion I think this is trending in the direction
> of 10-second reporting windows system wide unless that doesn't work for
> some reason.

This is a wise idea.

> I do worry about reporting many stalls even without
> show_mem(), however.  In situations where the allocations are
> unconstained, all userspace goes out to lunch for 10 seconds and that can
> result in thousands of threads all reporting stalls and spamming the
> kernel log.

Yeah, this looks scary even when all console drivers handled messages
in kthreads. I believe that printing details about all the stalled
tasks is not worth it. It might be enough to add an atomic counter
and print the number of stalled tasks within last 10 seconds.

> Idea is a 10 second threshold for reporting stalls and then only one stall 
> report across a 10 second sliding window globally.

I wonder if this even could be added to the existing watchdog,
aka report the number of stalled allocations in watchdog_timer_fn().

Best Regards,
Petr


  reply	other threads:[~2026-03-24  8:05 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
2026-03-23 16:53 ` Michal Hocko
2026-03-24  1:13   ` David Rientjes
2026-03-24  8:05     ` Petr Mladek [this message]
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=acJFyXIaMspV383t@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --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