Memory pressure describes how often Linux pauses work to reclaim memory, which typically shows up as latency spikes long before an out-of-memory event.
Reclaim happens when the kernel needs free pages for new allocations, dropping page cache first and swapping anonymous memory when necessary. Pressure Stall Information (PSI) exposes reclaim-induced stalls via /proc/pressure/memory, providing time-windowed averages that track real slowdowns more directly than a single “free RAM” snapshot.
Short bursts are normal during cache churn, builds, or restarts. Sustained non-zero PSI averages combined with swap-in activity often indicates RAM contention, an oversized workload, or an enforced memory limit in a cgroup.
Steps to check memory pressure with pressure stall information and vmstat in Linux:
- Review overall memory availability plus swap status.
$ free -h total used free shared buff/cache available Mem: 11Gi 1.2Gi 8.0Gi 48Mi 2.8Gi 10Gi Swap: 4.0Gi 0B 4.0Giavailable reflects reclaimable cache; consistently low available is more meaningful than low free.
- Sample swap-in plus swap-out rates over a short interval.
$ vmstat 1 5 procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu------- r b swpd free buff cache si so bi bo in cs us sy id wa st gu 0 0 0 8396360 284400 2621276 0 0 107 267 551 0 0 0 99 0 0 0 0 0 0 8440064 284400 2621276 0 0 0 0 386 494 0 0 100 0 0 0 0 0 0 8440064 284400 2621276 0 0 0 0 422 535 0 0 100 0 0 0 0 0 0 8440064 284400 2621276 0 0 0 0 190 223 0 0 100 0 0 0 0 0 0 8440064 284404 2621276 0 0 0 20 263 311 0 0 100 0 0 0
The first report line is an average since boot; focus on the interval lines that follow.
Sustained non-zero si indicates swap-in, which commonly correlates with reclaim stalls.
- Read memory Pressure Stall Information metrics.
$ cat /proc/pressure/memory some avg10=0.00 avg60=0.00 avg300=0.00 total=1451483 full avg10=0.00 avg60=0.00 avg300=0.00 total=1445159
some tracks time when at least one task is stalled on reclaim; full tracks time when all runnable tasks are stalled.
avg10, avg60, and avg300 represent the percentage of wall time spent stalled in each window; total is cumulative stall time in microseconds.
- Watch PSI averages during an observed slowdown.
$ timeout 2 cat /proc/pressure/memory some avg10=0.00 avg60=0.00 avg300=0.00 total=1451483 full avg10=0.00 avg60=0.00 avg300=0.00 total=1445159
Non-zero full pressure indicates system-wide stalls; interactive latency typically becomes obvious at that point.
- Locate cgroup v2 memory pressure files when troubleshooting containers or systemd services.
$ find /sys/fs/cgroup/system.slice -maxdepth 3 -name memory.pressure | head find: ‘/sys/fs/cgroup/system.slice’: No such file or directory
Read any listed memory.pressure file the same way as /proc/pressure/memory for a per-cgroup view.
- Confirm pressure returns near zero during idle periods.
$ cat /proc/pressure/memory some avg10=0.00 avg60=0.00 avg300=0.00 total=1451483 full avg10=0.00 avg60=0.00 avg300=0.00 total=1445159
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
