Skip to main content

detect_memory_stall

Function detect_memory_stall 

Source
pub fn detect_memory_stall() -> Option<f64>
Available on crate feature memory only.
Expand description

Memory PSI stall fraction: cgroup v2 memory.pressure some avg10, as a 0.0-1.0 fraction (avg10 is the percentage of the last 10s in which at least one task stalled waiting on memory).

This is the earliest memory-pressure signal – it rises on reclaim/thrash before byte ratios cross a threshold. Exposed for observability (emit it as a gauge and alert on it); it is deliberately NOT folded into the scale/shed decision, because the stall-percent at which to act is workload-specific and wants per-service calibration, not a guessed constant.

None when PSI is unavailable (kernel < 4.20, PSI disabled, or cgroup v1).