* [PATCH] sched/psi: Check triggers before updating averages on read
@ 2026-11-16 12:34 Avi Weiss
0 siblings, 0 replies; only message in thread
From: Avi Weiss @ 2026-11-16 12:34 UTC (permalink / raw)
To: Johannes Weiner, Suren Baghdasaryan
Cc: Peter Zijlstra, Ingo Molnar, Juri Lelli, Vincent Guittot,
Domenico Cerasuolo, linux-kernel, Avi Weiss
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@gmail.com>
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-16 12:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 12:34 [PATCH] sched/psi: Check triggers before updating averages on read Avi Weiss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®