Re: [PATCH v2 04/12] sched/core: Make __update_rq_clock() skip updates on UPDATED
From: Tejun Heo
Date: Wed Nov 11 2026 - 13:07:00 EST
Hello, Peter.
(cc'ing Changwoo)
On Wed, Nov 11, 2026 at 01:25:24PM +0100, Peter Zijlstra wrote:
> Notably, I want dequeue and pick / set-next to have the same timestamp
> such that the whole of schedule appears to happen at one instant in
> time.
>
> For ext you've explicitly chosen to not do so, per the placement of
> scx_rq_clock_invalidate().
IIRC, that wasn't to get a fresh clock after each lock drop. The goals
were:
1. Use the cached rq clock to avoid reading the hardware clock in most
cases.
2. Avoid reading a really stale clock after the scheduling session is
long over.
The invalidation is there for the second. With the existing code, the
cached clock can stay around long after the session is finished.
If the core tracks the session and whether the clock is up to date as
suggested in the reply to the cover letter, scx doesn't need its own
valid flag and can do what the other users do. With the rq locked and
pinned, update the clock if needed and use it. Without the lock, use it
if in session and up to date. Otherwise, read the hardware clock.
Thanks.
--
tejun