Re: [PATCH 13/14] sched: Add {DE,EN}QUEUE_LOCKED

Tejun Heo
2025-09-12T16:32:34Z

Hello,

On Fri, Sep 12, 2025 at 04:19:04PM +0200, Peter Zijlstra wrote:
...
> Ah, but I think we *have* to change it :/ The thing is that with the new
> pick you can change 'rq' without holding the source rq->lock. So we
> can't maintain this list.
>
> Could something like so work?
>
> scoped_guard (rcu) for_each_process_thread(g, p) {
> if (p->flags & PF_EXITING || p->sched_class != ext_sched_class)
> continue;
>
> guard(task_rq_lock)(p);
> scoped_guard (sched_change, p) {
> /* no-op */
> }
> }

Yeah, or I can make scx_tasks iteration smarter so that it can skip through
the list for tasks which aren't runnable. As long as it doesn't do lock ops
on every task, it should be fine. I think this is solvable one way or
another. Let's continue in the other subthread.

Thanks.

--
tejun