|
|
Subscribe / Log in / New account

The BPF extensible scheduler class

It was only a matter of time before somebody found a way to inject BPF into the CPU scheduler. This patch series, posted by Tejun Heo and containing work by David Vernet, Josh Don, and Barret Rhoden, does exactly that. The cover letter covers the motivation behind this work in detail:

One of our main goals was to lower the barrier to entry for experimenting with the scheduler. sched_ext provides ergonomic callbacks and helpers to ease common operations such as managing idle CPUs, scheduling tasks on arbitrary CPUs, handling preemptions from other scheduling classes, and more. While sched_ext does require some ramp-up, the complexity is self-contained, and the learning curve gradual. Developers can ramp up by first implementing simple policies such as global FIFO in only tens of lines of code, and then continue to learn the APIs and building blocks available with sched_ext as they build more featureful and complex schedulers.

There is a bit more documentation in this patch.


(Log in to post comments)

The BPF extensible scheduler class

Posted Nov 30, 2022 13:25 UTC (Wed) by dullfire (subscriber, #111432) [Link]

I first read "featureful" as "fearful". Upon further reflection, I suspect this will often (but not always) be an acceptable substitution.

The BPF extensible scheduler class

Posted Dec 3, 2022 0:23 UTC (Sat) by riking (subscriber, #95706) [Link]

The architecture where the kernel can evict the userspace scheduler and go back to CFS is interesting. It's unclear whether a timeout eviction is actually reported to userspace in a way that the system operator can notice?

The BPF extensible scheduler class

Posted Dec 4, 2022 17:46 UTC (Sun) by Manifault (subscriber, #155796) [Link]

If you look at [0], one of the struct sched_ext_ops callbacks is the following:

/**
* exit - Clean up after the BPF scheduler
* @info: Exit info
*/
void (*exit)(struct scx_exit_info *info);

That ops.exit() callback will be invoked with SCX_EXIT_ERROR_STALL [1] in the event of a hung task causing the BPF scheduler to be evicted, so BPF does have a chance to handle / record / etc the scheduler being evicted for timeouts.

[0]: https://lore.kernel.org/all/20221130082313.3241517-15-tj@...
[1]: https://lore.kernel.org/all/20221130082313.3241517-19-tj@...


Copyright © 2022, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds