From: Avi Weiss <thnkslprpt@gmail.com>
To: Johannes Weiner <hannes@cmpxchg.org>,
Suren Baghdasaryan <surenb@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Domenico Cerasuolo <cerasuolodomenico@gmail.com>,
linux-kernel@vger.kernel.org, Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH] sched/psi: Check triggers before updating averages on read
Date: Mon, 16 Nov 2026 14:34:24 +0200 [thread overview]
Message-ID: <20261116123423.743790-2-thnkslprpt@gmail.com> (raw)
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
reply other threads:[~2026-11-16 12:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116123423.743790-2-thnkslprpt@gmail.com \
--to=thnkslprpt@gmail.com \
--cc=cerasuolodomenico@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=surenb@google.com \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®