sched/psi: Check triggers before updating averages on read
Subsystems (2)
PATCH 1/1 sched/psi: Check triggers before updating averages on read
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 <[email protected]>
--- kernel/sched/psi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/sched/psi.c +3 -1
@@ -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
Signature · 1 line
2.43.0