# Rust-ifying the Linux Kernel Scheduler with sched-ext > [! note]- > The content of this page is generated by audio/video transcription and text transformation from the content and links of this source. Source: [https://fosdem.org/2025/schedule/event/fosdem-2025-4620-rust-ifying-the-linux-kernel-scheduler-in-user-space-/](https://fosdem.org/2025/schedule/event/fosdem-2025-4620-rust-ifying-the-linux-kernel-scheduler-in-user-space-/) <video src="https://video.fosdem.org/2025/ub2252a/fosdem-2025-4620-rust-ifying-the-linux-kernel-scheduler-in-user-space-.av1.webm" controls></video> ## Summary & Highlights: **Summary of the Session** This session delves into the innovative approach of using Rust and sched-ext to transform the Linux kernel scheduler into a more flexible and accessible component for developers. By leveraging user-space programming, the session demonstrates how custom CPU scheduling policies can be created and tested without the need for deep kernel knowledge. Andrea Righi presents the scx_rustland framework, which enables rapid experimentation and integration with user-space libraries, showcasing its potential through a proof-of-concept scheduler that improves performance in specific scenarios. **Introduction to CPU Scheduling** The session begins by explaining the critical role of the CPU scheduler in managing task execution within operating systems. Traditionally, customizing CPU scheduling policies required expertise in kernel development, limiting experimentation to a select few. The introduction of sched-ext and BPF technologies opens up new possibilities for developers to create bespoke scheduling policies in user space, thus democratizing access to CPU performance tuning. **The Role of Rust and sched-ext** Rust and sched-ext are highlighted as key technologies in this transformation. Rust is used to implement schedulers in user space, allowing developers to utilize its robust type system and safety features. sched-ext, a Linux kernel technology, facilitates the implementation of scheduling policies as BPF programs, enabling rapid experimentation and safe testing without compromising kernel stability. **Proof of Concept: The scx_rustland Scheduler** A proof-of-concept scheduler, scx_rustland, is presented to demonstrate the practical application of these technologies. This scheduler is designed to prioritize latency-sensitive tasks, such as gaming applications, showcasing significant performance improvements in specific use cases. The session emphasizes that while Rust and sched-ext do not inherently make scheduling faster, they provide a powerful platform for experimentation and customization. **Conclusion and Implications for Eco-Social Transformation** The session concludes by exploring the broader implications of this technology for eco-social transformation. By enabling more efficient and tailored CPU usage, these advancements can contribute to reduced energy consumption and improved system performance across various sectors. The potential for rapid experimentation and integration with user-space components also opens new avenues for innovation in sustainable technology design. ## Importance for an eco-social transformation The session's approach to CPU scheduling has significant implications for eco-social transformation. By enabling more efficient and tailored CPU usage, it can contribute to reduced energy consumption and improved system performance, aligning with sustainability goals. The ability to rapidly experiment with and deploy custom schedulers in user space empowers developers to optimize systems for specific workloads, potentially reducing resource waste. Eco-social designers can leverage this technology to create more sustainable and responsive applications. Challenges include navigating the complexities of BPF programming and ensuring that custom schedulers do not introduce fairness issues or resource monopolization. Socially, the democratization of CPU scheduling can foster innovation and collaboration across diverse fields, supporting community-driven technology development. ## Slides: | | | | --- | --- | | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_001.jpg\|300]] | The session titled 'Rust-ifying the Linux kernel scheduler in user space' is presented by Andrea Righi from NVIDIA. It focuses on the innovative use of Rust to transform the Linux kernel scheduler, making it more accessible and customizable for a wider range of developers. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_002.jpg\|300]] | The agenda for the session includes an introduction to scheduling, an overview of sched_ext and BPF, a discussion on implementing the Linux scheduler in Rust, and a conclusion summarizing the key learnings. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_003.jpg\|300]] | This slide introduces the concept of scheduling, which is central to the session's focus on transforming the Linux kernel scheduler using Rust and user-space programming. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_004.jpg\|300]] | A scheduler is defined as a kernel component responsible for determining where, when, and how long each task runs. This foundational understanding is crucial for exploring how Rust can be used to enhance scheduling capabilities. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_005.jpg\|300]] | The challenges of scheduling are outlined, including ensuring fairness among tasks, optimizing resource use, minimizing overhead, and creating a general solution that works across different architectures and workloads. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_006.jpg\|300]] | The slide discusses the traditional approach to scheduling in Linux, which relies on a single scheduler to manage all tasks. This approach makes experimentation and upstream changes challenging, highlighting the need for more flexible solutions. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_007.jpg\|300]] | An introduction to sched_ext and BPF, technologies that enable the implementation of custom scheduling policies in the Linux kernel, paving the way for more dynamic and user-friendly scheduling solutions. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_008.jpg\|300]] | sched_ext is described as an extensible scheduling class within the Linux kernel that allows for the implementation of scheduling policies as BPF programs. Key features include bespoke policies, rapid experimentation, and safety. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_009.jpg\|300]] | This slide explains how sched_ext functions, providing a technical foundation for understanding its role in enabling user-space scheduling with Rust. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_010.jpg\|300]] | The limitations of sched_ext are discussed, including the restricted programming model of BPF, the complexity of the BPF verifier, and kernel restrictions that limit access to user-space libraries and floating-point operations. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_011.jpg\|300]] | The concept of implementing the Linux scheduler in Rust is introduced, highlighting the potential for offloading complexity to user space and accessing a wider range of programming tools and libraries. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_012.jpg\|300]] | The idea of using sched_ext and BPF to channel scheduling events to user space is presented. This approach allows scheduling decisions to be made in user space, leveraging the flexibility and resources available in that environment. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_013.jpg\|300]] | This slide outlines the design of a user-space Rust scheduler, providing a framework for understanding how Rust can be used to implement flexible and efficient scheduling solutions. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_014.jpg\|300]] | The scx_rustland scheduler is introduced as an EDF-based scheduler that evaluates deadlines based on task vruntime and voluntary context switch rates. Tasks receive time slices inversely proportional to the number of waiting tasks. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_015.jpg\|300]] | A practical demonstration of the scx_rustland scheduler is shown, highlighting its ability to improve performance when playing a video game while simultaneously building the kernel. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_016.jpg\|300]] | The performance of the EEVDF scheduler is compared to the scx_rustland scheduler using the Perfetto tool, illustrating the potential benefits of user-space scheduling with Rust. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_017.jpg\|300]] | The session discusses the generalization of user-space Rust scheduling through the Rustland core framework, which provides generic scheduling APIs and is available as a Rust crate for easy implementation. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_018.jpg\|300]] | The design of the scx_rustland_core framework is detailed, explaining how it abstracts the backend and exposes generic APIs for implementing host-wide Linux scheduling policies. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_019.jpg\|300]] | A FIFO scheduler implemented in the scx_rustland_core framework is presented, showcasing the practical application of the framework in creating efficient scheduling solutions. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_020.jpg\|300]] | The conclusion of the session emphasizes the potential of Rust and sched_ext for transforming Linux scheduling, highlighting the ease of experimentation and integration with user-space components. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_021.jpg\|300]] | Key takeaways include that scx_rustland is not inherently a better scheduler, but its value lies in the ease of experimentation and integration with Rust's user-space components, facilitating rapid testing and development. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_022.jpg\|300]] | References are provided for further exploration of the main scx repository and the Rust scheduler template, offering resources for developers interested in implementing custom scheduling solutions. | ![[FOSDEM 2025/assets/Rustifying-the-Linux-kernel-scheduler-in-user-spac/preview_023.jpg\|300]] | The session concludes with an invitation for questions and further discussion, emphasizing Andrea Righi's willingness to engage with attendees on the presented topics. ## Links [Slides](https://fosdem.org/2025/events/attachments/fosdem-2025-4620-rust-ifying-the-linux-kernel-scheduler-in-user-space-/slides/238238/Rust-ifyi_PRcGR8u.pdf) [Video recording (AV1/WebM)](https://video.fosdem.org/2025/ub2252a/fosdem-2025-4620-rust-ifying-the-linux-kernel-scheduler-in-user-space-.av1.webm) [Video recording (MP4)](https://video.fosdem.org/2025/ub2252a/fosdem-2025-4620-rust-ifying-the-linux-kernel-scheduler-in-user-space-.av1.mp4)