Use of eBPF in CPU Scheduler
linuxplumbersconf.org
linuxplumbersconf.org
There are a lot of parallels between the Smalltalk VMs (where nearly everything about the system is editable and accessible to the user) and where Linux is heading in certain respects, except going there by a very round-about way and relying on very limited binary formats and C instead of high level languages and live objects.
[1]: https://www.humprog.org/~stephen//research/papers/kell19unix...
Other recent related developments and news:
https://github.com/rgushchin/atc
https://www.phoronix.com/scan.php?page=news_item&px=Linux-BPF-Scheduler
https://lore.kernel.org/bpf/CA+khW7i460ey-UFzpMSJ8AP9QeD8ufa4FzLA4PQckNP00ShQSw@mail.gmail.com/T/#uHaving the kernel accessible from userspace as it already is saves two steps, but you still have to use the kernel as a middleman unless there's some way for the scheduler program to directly jump into another process (which I don't think there is because wouldn't this break memory protection?)
They tried to upstream it but kernel maintainers lack the industry experience that would allow them to perceive the benefits.
https://lkml.org/lkml/2020/7/22/1202
Apparently now known as UMCG.
The first argument would be a list of tasks to be run before the syscall returns. The second argument would be a list of tasks to be run in that order (with the possibility of unlisted tasks being run between them) before the syscall returns.
This could not only replace switchTo, it also would enable scheduling from user space with a very small number of context switches. I'd call this syscall "schedule".
I think switchto (which became futex_swap which became umcg_swap) from thread X is roughly "suspend the current thread (X) and unsuspend Y", where suspend is "wait on a futex". When all of the tasks you propose specifying are done, one of them can just unsuspend X (possibly suspending itself at the same time). (Caveat: I don't really know what changed between futex_swap and umcg_swap.)
btw, I don't think it's fair to say the kernel maintainers lacked the industry experience to perceive the benefits. I've glanced at some of the UMCG threads and it seems like reviewers have legitimate feedback aimed at improving the patchset rather than rejecting it. Assuming posk has enough time to keep making new drafts, I expect it to be merged eventually.
The described approach allow, for example, for a process to choose how its children will be scheduled. I don't think google's proposal allows that.
This ghOSt thing looks unrelated and system-wide. Like a more customizable version of the usual kernel scheduling. But I'm guessing based on one paragraph and will be interested to see the paper/presentation.
I'm not sure if there's any big gap between where neither does what you want.
Then the actual kernel-side scheduling process would just involve 1. the kernel popping things off the "to preempt" queue and setting interrupts on those cores; and 2. the preemption interrupt handler popping a process-block ref off the "next workload on this core" queue and switching to it. With no actual decision-making happening at preempt time.
(This is irrelevant to the greater point, though, because eBPF isn't a userspace process in the first place.)
See https://ebpf.io/ for more info.
https://netdevconf.info/0x15/slides/25/ghOSt%20Talk%20(Netde...
"Fast & Flexible User-Space Delegation of Linux Scheduling"
from Google, July 2021