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

Linus Torvalds
2024-06-20T05:08:35Z

[ I'll try to look more at this tomorrow, but I'll send this part early ]

On Wed, 19 Jun 2024 at 19:35, Thomas Gleixner <tglx@linutronix.de> wrote:
>
> When I sat there in Richmond with the sched_ext people I gave them very
> deep technical feedback especially on the way how they integrate it:
>
> Sprinkle hooks and callbacks all over the place until it works by some
> definition of works.

Are we even talking about the same thing?

There are basically two new hooks, for reweight_task (which is
something the fair scheduler wanted and was the only user of) and for
switching_to(), which is the class changing (again, mainly because
there's now not a hardcoded "normal" class).

And yes, there are a couple of other things where the CFS rules were
just encoded in the core scheduler code, and they got an extra check
or whatever (eg the SCHED_NORMAL changes and things like stop-tick -
things that changed simply because now there isn't a single normal
scheduler any more).

The rest are mostly all the existing scheduler call-ins, afaik. Or
_exactly_ the same thing that other schedulers already do, like the
task_prio() stuff.

Yes, there's scx_rq_activate/deactivate at CPU up/down time. Doesn't
look unreasonable to me. Same goes for the idle cpu management.

In other cases, it takes a few code sequences, turns them into helper
functions, just to be able to re-use them.

The ugliest parts are from what I can see the whole "ok, stop using
user space input over PM events" and that "bypass" stuff is sure not
pretty.

But that's pretty much all internal to sched_ext, and seems mostly
like a sane approach to "what if we do policy in user space"?

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.

But "sprinkle hooks and callbacks all over the place"?

Could things like that next_active_class() perhaps be done more
prettily? I'm sure.

But I get the very strong feeling that people wanted to limit the
amount of changes they made to the core scheduler code.

> I clearly offered you to try to resolve this amicably within a
> reasonable time frame.
>
> How exaclty is that equivalent to "continue to do nothing" ?

So if we actually *can* resolve this amicably in three months, then
that sounds worth it.

But my reaction is "what changed"? Nothing has become more amicable in
the last nine months. What makes the next three months special?

Linus