Re: [PATCH 2/7] sched/core: Simplify/fix time updates

From: Tejun Heo

Date: Wed Sep 02 2026 - 01:38:58 EST


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.

>
> - p = pick_task(rq_i, rf);
> + p = pick_task(rq_i, &rf_i);
> if (unlikely(seq != rq->core->core_task_seq ||
> - WARN_ON_ONCE(p == RETRY_TASK))) {
> - /* rq lock may have been dropped, clocks invalidated */
> - core_clock_updated = false;
> - if (!(rq->clock_update_flags & RQCF_UPDATED))
> - update_rq_clock(rq);
> + WARN_ON_ONCE(p == RETRY_TASK)))
> goto restart;
> - }

Thanks.

--
tejun