Re: [PATCH resend 2/2] sched: psi: use rq_clock() during task state changes

From: Peter Zijlstra

Date: Mon Feb 02 2026 - 15:42:01 EST


On Wed, Jan 14, 2026 at 10:43:17AM -0500, Johannes Weiner wrote:
> In the hottest psi paths, the scheduler already caches the cpu_clock()
> call for the event in rq->clock. Now that the clocks between state
> changes and pressure aggregation don't need to be synchronized inside
> the seqcount section anymore, use the cheaper rq_clock().
>
> Add update_rq_clock() calls to the few places where psi is entered
> without the rq already locked.

Just to be clear, rq->clock is not a cache of cpu_clock(). rq->clock
discards all backwards motion (which obviously should never happen, but
if it does, the clocks go out of sync).

So if you use rq->clock, you must use it for all and not mix with
cpu_clock().

I *think* the patch does that, but I've not double checked.