Re: [PATCH 2/7] sched/core: Simplify/fix time updates
From: Peter Zijlstra
Date: Wed Sep 02 2026 - 10:41:34 EST
On Tue, Sep 01, 2026 at 07:38:49PM -1000, Tejun Heo wrote:
> Hello,
>
> On Fri, Aug 28, 2026 at 12:17:01PM +0200, Peter Zijlstra wrote:
> > +static void opt_update_rq_clock(struct rq *rq)
> > +{
> > + if (!(rq->clock_update_flags & RQCF_UPDATED))
> > + update_rq_clock(rq);
> > +}
>
> Yeah, I think this really needs sth like this. That said,
>
> > @@ -6336,18 +6336,12 @@ pick_next_task(struct rq *rq, struct rq_
> > * pick_next_task(). If the current cpu is not the core,
> > * the core may also have been updated above.
> > */
> > - if (i != cpu && (rq_i != rq->core || !core_clock_updated))
> > - update_rq_clock(rq_i);
> > + opt_update_rq_clock(rq_i);
>
> I don't think this is correct. A sibling rq wouldn't necessarily have
> RCQF_UPDATED cleared from whenever it scheduled / ticked the last time, so
> the following pick_task() can run with pretty stale rq clock.
Ah, indeed. We should clear clock_update_flags on unlock, rather than on
lock. Thanks!