Re: [PATCH v2 06/12] sched/core: New rq_{pin,drop,repin,unpin}_lock() semantics

From: Tejun Heo

Date: Wed Nov 11 2026 - 05:43:38 EST


Hello,

On Sat, Nov 07, 2026 at 12:59:19PM +0100, Peter Zijlstra wrote:
> static inline void rq_drop_lock(struct rq *rq, struct rq_flags *rf)
> {
> - rq_unpin_lock(rq, rf);
> + rf->clock_update_flags = rq_clock_freeze(rq);
> + scx_rq_clock_invalidate(rq);
> + lockdep_unpin_lock(__rq_lockp(rq), rf->cookie);
> }

As 02/12 switched __balance_callbacks() to rq_drop_lock(), it now goes
through rq_clock_freeze() and its assert_clock_updated() whether a
callback is queued or not. The scx task iterator calls
__balance_callbacks() before each unlock and doesn't necessarily update
the clock in between, so loading a BPF scheduler triggers:

WARNING: kernel/sched/sched.h:1862 at __balance_callbacks
__scx_task_iter_rq_unlock
scx_task_iter_unlock
scx_root_enable_workfn

__balance_callbacks() could skip the drop when no callback is queued,
but that's getting too subtle. The scx side can manually update the
clock there too, but overall the whole thing is looking a bit too
brittle.

Thanks.

--
tejun