Re: [PATCH] sched/psi: add cpu_prio pressure metric for high-priority task stalls

From: Peter Zijlstra

Date: Wed Aug 12 2026 - 09:33:34 EST


On Tue, Aug 11, 2026 at 06:46:10PM +0800, shisiyuan wrote:
> From: shisiyuan <shisiyuan@xxxxxxxxxxx>
>
> Introduce a new PSI (Pressure Stall Information) indicator that
> measures how much walltime priority-sensitive tasks spend waiting
> for CPU, exposed as /proc/pressure/cpu_prio alongside the existing
> io/memory/cpu/irq metrics.
>
> A task is considered "high priority" when its static priority is
> at or below CONFIG_PSI_TASK_PRIO_THLD (default 118). The scheduler
> tracks a dedicated task count and state bit for such tasks,
> mirroring the existing CPU SOME/FULL accounting, so CPU contention
> affecting latency-sensitive workloads can be observed independently
> of overall CPU pressure. Both 'some' and 'full' states are tracked;
> 'full' is undefined at the system level (always reported as zero),
> same as regular CPU pressure, but is meaningful at the cgroup level,
> where it reflects the share of time no high-priority task in that
> cgroup is able to run.
>
> To keep the metric accurate across priority changes, ENQUEUE_PSI/
> DEQUEUE_PSI flags are added and set by set_user_nice(),
> sched_setscheduler() and rt_mutex_setprio(), forcing PSI state to
> be re-evaluated whenever a task's priority is adjusted rather than
> only on enqueue/dequeue.
>
> The priority threshold is exported as a Kconfig knob
> (CONFIG_PSI_TASK_PRIO_THLD) so it can be tuned per platform without
> touching source code.

Yeah, I think not.