[PATCH] sched/psi: Check triggers before updating averages on read

From: Avi Weiss

Date: Mon Nov 16 2026 - 07:34:33 EST


psi_show() can advance the averaging totals and deadline before
psi_avgs_work() checks PSI_AVGS triggers. When a pressure-file read
runs in this interval, the worker can miss a completed threshold
breach, leaving an unprivileged monitor without a POLLPRI event.

Check averaging triggers before updating the averages in psi_show(),
matching the ordering used by psi_avgs_work().

Fixes: d82caa273565 ("sched/psi: Allow unprivileged polling of N*2s period")
Signed-off-by: Avi Weiss <thnkslprpt@xxxxxxxxx>
---
kernel/sched/psi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 7c5381423334..351d50cc0663 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1261,8 +1261,10 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res)
mutex_lock(&group->avgs_lock);
now = sched_clock();
collect_percpu_times(group, PSI_AVGS, NULL);
- if (now >= group->avg_next_update)
+ if (now >= group->avg_next_update) {
+ update_triggers(group, now, PSI_AVGS);
group->avg_next_update = update_averages(group, now);
+ }
mutex_unlock(&group->avgs_lock);

#ifdef CONFIG_IRQ_TIME_ACCOUNTING

base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
--
2.43.0