From: Michal Hocko <mhocko@suse.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Daniil Tatianin <d-tatianin@yandex-team.ru>,
linux-mm@kvack.org, Vlastimil Babka <vbabka@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Brendan Jackman <brendan.jackman@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Mike Rapoport <rppt@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/vmstat: add per-order allocation slow path statistics
Date: Fri, 21 Aug 2026 09:50:32 +0200 [thread overview]
Message-ID: <aogDSG8a68CrMQpL@tiehlicka> (raw)
In-Reply-To: <20260820154913.3d6a821f6ba5c1f81d134a0a@linux-foundation.org>
On Thu 20-08-26 15:49:13, Andrew Morton wrote:
> On Thu, 20 Aug 2026 16:36:58 +0300 Daniil Tatianin <d-tatianin@yandex-team.ru> wrote:
>
> > Production incidents caused by bursts of high-order allocations all
> > entering direct compaction are currently hard to attribute from
> > /proc/vmstat: pgalloc_* has no order breakdown, and compact_stall does
> > not say which order stalled. Tracepoints can recover this on a single
> > machine, but they are impractical as an always-on fleet-wide monitoring
> > source, which is what is needed to correlate latency regressions with
> > allocation behavior after the fact.
> >
> > Add per-order event counters to /proc/vmstat, covering only the
> > allocation slow path, so the page allocator fast path is not touched
> > at all:
> >
> > - pgalloc_slowpath_orderN: entries into __alloc_pages_slowpath(),
> > counted once per allocation, before the restart loop
> > - pgalloc_fail_orderN: allocations that returned NULL to the caller
> > (including a successful allocation freed by memcg charge failure)
> > - compact_stall_orderN / compact_success_orderN: per-order split of
> > the existing direct compaction counters, order 0 is omitted since
> > direct compaction is never entered for it
> >
> > All new counters are purely additive: the existing keys are untouched
> > and compact_stall == sum of compact_stall_orderN.
> >
> > alloc_pages_nolock() is deliberately not counted: it is opportunistic,
> > never enters the slow path, and its NULL returns are expected rather
> > than failures.
> >
> > Counter names are generated for any MAX_PAGE_ORDER the arch Kconfig
> > ranges allow (10..13), a static_assert catches larger values.
>
> AI review got upset about this:
> https://sashiko.dev/#/patchset/20260820133659.712111-1-d-tatianin@yandex-team.ru
>
> > A per-order split of PGALLOC itself was proposed in 2017 but stalled
> > over fast path overhead concerns, restricting the counters to the slow
> > path avoids that overhead entirely while still capturing the
> > allocations that cause latency.
>
> Seems useful, thanks.
I would rather not put that into ever growing vmstat and bloat it even
more. Most users simply do not care about that level of details. What do
we expect next, per migrate target/order stats because somebody might be
interested to debug fragmentation better?
Would it be sufficient to have a dedicated debugfs interface? The
argument about tracepoints scalability is also rather weak. There are
examples of successfull bpf, tracing deployments at large scales so this
certainly is not a new problem to tackle.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2026-08-21 7:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 13:36 [PATCH] mm/vmstat: add per-order allocation slow path statistics Daniil Tatianin
2026-08-20 22:49 ` Andrew Morton
2026-08-21 0:24 ` Daniil Tatianin
2026-08-21 7:50 ` Michal Hocko [this message]
2026-08-21 7:42 ` kernel test robot
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=aogDSG8a68CrMQpL@tiehlicka \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=brendan.jackman@linux.dev \
--cc=d-tatianin@yandex-team.ru \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=rppt@kernel.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