Re: [PATCHSET v6] sched: Implement BPF extensible scheduler class

From: Linus Torvalds
Date: Thu Jun 20 2024 - 13:12:40 EST


On Wed, 19 Jun 2024 at 22:07, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> And scx_next_task_picked() isn't pretty - as far as I understand, it's
> because there's only a "class X picked" callback ("pick_next_task()"),
> and no way to tell other classes they weren't picked.

I guess that could be a class callback, something like this:

p = class->pick_next_task(rq);
if (p)
if (p) {
- scx_next_task_picked(rq, p, class);
+ struct sched_class *prev = last->sched_class;
+ if (class != prev && prev->switch_class)
+ prev->switch_class(rq);
return p;
}

and that would be arguably much prettier. But maybe I've
mis-understood the reason for that scx_next_task_picked() thing.

Tejun?

Linus