Dear Johannes,

On Mon, Jul 13, 2026 at 5:29 PM Johannes Weiner <[email protected]> wrote:
>
> On Thu, Jul 02, 2026 at 10:46:05PM +0530, Pintu Kumar Agarwal wrote:
> > Hi all,
> >
> > This RFC introduces an in-kernel PSI auto monitor aimed at improving
> > root-cause visibility for resource pressure events in Linux systems.
> >
> > Motivation:
> >
> > PSI already provides an excellent mechanism to detect CPU, memory and
> > I/O pressure and includes trigger-based notifications via pollable
> > interfaces. However, it deliberately avoids attributing pressure to
> > individual tasks.
>
> Why is this necessary?
>
> > In real-world systems, this creates a gap: when a PSI trigger fires,
> > users still need to determine *which tasks caused the stall* by combining
> > multiple tools (top, meminfo, vmstat, perf, tracing, etc.), often after
> > the event has already passed.
>
> I've never found myself needing to identify which specific task was
> stalled. Tasks competing over a shared resource are interdependent.
>
> Consider this scenario: Task A, B, C are allocating memory and
> creating pressure together; B randomly becomes the sucker to hit
> direct reclaim and making room for the other too as well. Why is it
> meaningful to know that B stalled? It caused the resource contention
> no more than the other two.
>
> Then A and C refault: A is fast, but C happens to hit when the flash
> drive is running garbage collection. Why is it meaningful to know C?
> Again, C is no more the culprit in that situation than the others.
>
> The meaningful thing you can say is that the domain as a whole is
> under pressure. Who exactly becomes the lightning rod is noise.
>
> That said, if you do need it, why not use delayacct? It already tracks
> the reclaim, swap, thrashing time and events that also go into psi on
> a per-task basis. It's not sampled, either.

Thank you so much for your detailed feedback. This is very helpful.
Your point about resource pressure being a domain-level phenomenon
rather is well taken.
I agree that pressure is often created collectively by multiple
workloads, and that the task experiencing the stall is not necessarily
the root cause.

The goal of the RFC was not to identify a single culprit, but to
provide additional attribution context and surrounding tasks around
PSI events
by capturing the major resource consumers and participants exactly at
the time pressure becomes significant.

Your suggestion regarding delayacct is very insightful.
I think there is a utility under tools/accounting/delaytop.c which
already provides task-level delay information in user space when run
manually.

I am currently studying delayacct, taskstats and the existing delaytop
utility to understand how I can correlate PSI auto-monitor attribution
using delayacct.
The idea could be:
PSI threshold breach -> PSI Auto Monitor trigger -> Delayacct provides
delayed task list -> Auto monitor dump / create trace events
PSI threshold breach -> PSI Auto Monitor is triggered -> Collect
per-task delayacct/taskstats data
-> Identify tasks with significant reclaim / swap / I/O / CPU
scheduling delay -> Emit trace events / logs / structured report

One additional motivation for the in-kernel prototype was early-boot
observability.
Unlike a userspace monitor, it can capture pressure events and
attribution context before userspace services are available,
which proved useful in several embedded boot-time investigations.
One more point is that the psi auto monitor can run and trigger on its
own during early boot.
It can quickly help to identify bottlenecks during boot and aid in
boot time optimization at both kernel and user space level.

As a side note, please see one of the snapshots below captured during boot.
# dmesg | grep psi
[   30.948653][  T420] psi_monitor: pressure high: cpu=50% mem=1%
io=11% (thresh cpu=50 mem=60 io=40)
[   30.958342][  T420] psi_monitor: logging top 8 tasks under pressure:
[   30.964959][  T420] psi_monitor: pid=2637 comm=pcid-loc-api
psi_flag=12 oncpu=0 cputime(ms)=443 rss(kB)=21976 io(kB)=0 score=13203
[   30.977392][  T420] psi_monitor: pid=1974 comm=syslogd psi_flag=0
oncpu=3 cputime(ms)=643 rss(kB)=2156 io(kB)=272 score=4565
[   30.989137][  T420] psi_monitor: pid=2597 comm=qwesd psi_flag=4
oncpu=3 cputime(ms)=104 rss(kB)=7964 io(kB)=0 score=4502
[   31.000540][  T420] psi_monitor: pid=1493 comm=dlt-system
psi_flag=0 oncpu=3 cputime(ms)=370 rss(kB)=1984 io(kB)=136 score=2978
[   31.014588][  T420] psi_monitor: pid=15 comm=rcu_preempt psi_flag=0
oncpu=2 cputime(ms)=443 rss(kB)=0 io(kB)=0 score=2215
[   31.033593][  T420] psi_monitor: pid=420 comm=kworker/2:9+events
psi_flag=12 oncpu=2 cputime(ms)=351 rss(kB)=0 io(kB)=0 score=1755
[   31.051276][  T420] psi_monitor: pid=2713 comm=sdir psi_flag=0
oncpu=1 cputime(ms)=124 rss(kB)=0 io(kB)=20 score=640
[   31.065800][  T420] psi_monitor: pid=41 comm=kworker/u8:1-memlat_wq
psi_flag=0 oncpu=3 cputime(ms)=52 rss(kB)=0 io(kB)=0 score=260


Thank you once again for your review and valuable feedback.
I will explore more and improve the design for v2.


Thanks,
Pintu

Reply via email to