Early Patches Bring BPF To The Linux Scheduler
Roman Gushchin of Facebook published an initial patch series for providing initial BPF support within the Linux CFS scheduler as a way for external code to safely alter select kernel decisions.
Roman noted in the patch series,"This leads to BPF hooks, which have been successfully used in various kernel subsystems to provide a way for external code to (safely) change a few kernel decisions. BPF tooling makes this pretty easy to do, and the people deploying BPF scripts are already quite used to updating them for new kernel versions. This patchset aims to start a discussion about potential applications of BPF to the scheduler. It also aims to land some very basic BPF infrastructure necessary to add new BPF hooks to the scheduler, a minimal set of useful helpers, corresponding libbpf changes, etc."
With BPF support in the Linux kernel scheduler among the possibilities being talked about are better catering scheduling policies depending upon the workload, better preemption handling, and experimenting with different policies in production settings.
Facebook's work so far with BPF for the scheduler is proving beneficial, "We're at a very early stage, however already have seen a nice latency and ~1% RPS wins for our (Facebook's) main web workload."
More details for those interested on the BPF mailing list.