Re: [PATCH 05/39] sched: Add sched_class->switching_to() and expose check_class_changing/changed()

Tejun Heo
2024-06-24T22:18:09Z

Hello, Peter.

On Mon, Jun 24, 2024 at 01:06:24PM +0200, Peter Zijlstra wrote:
...
> > + void (*switching_to) (struct rq *this_rq, struct task_struct *task);
> > void (*switched_from)(struct rq *this_rq, struct task_struct *task);
> > void (*switched_to) (struct rq *this_rq, struct task_struct *task);
>
> So I *think* that I can handle all the current cases in
> sched_class::{en,de}queue_task() if we add {EN,DE}QUEUE_CLASS flags.
>
> Would that work for the BPF thing as well?
>
> Something like the very much incomplete below... It would allow removing
> all these switch{ed,ing}_{to,from}() things entirely, instead of
> adding yet more.

Hmm... so, I tried to make it work for SCX but enqueue() and dequeue() are
only called if the task was queued at the time of sched_class change, right?
However, these callbacks expect to be called even when the task is not
currently queued. Maybe I'm misreading code but it looks like that'd break
other classes too. What am I missing?

Thanks.

--
tejun