-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scx_lavd: add LAVD (Latency-criticality Aware Virtual Deadline) scheduler #192
Conversation
…cheduler scx_lavd is a BPF scheduler that implements an LAVD (Latency-criticality Aware Virtual Deadline) scheduling algorithm. While LAVD is new and still evolving, its core ideas are 1) measuring how much a task is latency critical and 2) leveraging the task's latency-criticality information in making various scheduling decisions (e.g., task's deadline, time slice, etc.). As the name implies, LAVD is based on the foundation of deadline scheduling. This scheduler consists of the BPF part and the rust part. The BPF part makes all the scheduling decisions; the rust part loads the BPF code and conducts other chores (e.g., printing sampled scheduling decisions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks good to me. I've done some quick tests and I haven't seen any obvious issue. I left some inline comments.
Moreover, you may want to add a Signed-off-by line to your commits (all the other commits have a SoB line) and there are also some little coding style issues here and there, but nothing relevant.
For the Rust part you may want to run rustfmt scheds/rust/scx_lavd/src/main.rs
to automatically fix all the formatting issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I scanned through the code. Overall, looks great to me. Thanks for the contribution and please feel free to land whenever you are ready. We can iterate in the tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I actually went through the code this time. I really like the simplicity of it. The heuristics are easy to understand and conceptually concise. Please feel free to land anytime. Some overall thoughts:
- It looks like it would be relatively straight-forward to encapsulate the LAVD scheduling algorithm into a library so that it can be used by other schedulers to manage their in-domain scheduling.
- The mixture of raw nice values, 0-40 priority values and weights are a bit cumbersome. I suppose the intention was to ease table-mapping across different terms but that's not that difficult to do with well-defined linear weight values. The use of static_prio also makes it difficult to use it for flattened cgroup hierarchical scheduling as the flattened weight values need more than 40 levels of distinction. I think it should be possible to unify the values used to standardized weights without meaningfully affecting actual operation.
- There is no preemption. Was it that it wasn't necessary given the slices are fairly short and interactive tasks are prioritized heavily already? Or would it be interesting to explore that in the future?
👋 I am not sure if this is the right place to report this, but I find the following kernel oops when using scx_lavd: https://paste.soulharsh007.dev/p/43a4476.log Kernel Version: 6.8.1-2-cachyos |
Thank you for the report. If possible, can you provide some information when/how the bug happened? For example, shutdowning a laptop while listening a audio, etc.
|
Thanks for the report @SoulHarsh007. This crash would be due to a bug in the core framework, so I'm going to go ahead and merge this as it's an issue we'll have to fix over in https://github.com/sched-ext/sched_ext. I'll create an issue over there (tagging you in it) so we can track accordingly. |
@multics69 hope it's OK that I merged and to address the feedback in a subsequent PR -- some folks were asking about playing with this and I felt it might be easier to just merge it and iterate in tree given that it had been open for a few days. |
Sure, no problem. Thanks for taking care of that bug! |
scx_lavd: addressed comments from PR #192
Not sure if this is the correct place since it's merged, but I got this:
Also I had huge audio lag/issues in game when this scheduler was running. |
Thank you for reporting the issue. Would you mind providing a bit more detail which might help me to reproduce the problem? For example, CPU model, the played game, other programs ran, etc.
|
@multics69
|
Provide a deadline-based scheduler focused on latency-critical tasks inspired by gaming workloads. scx_lavd quantifies how much a task is latency-critical and leverages the task's latency-criticality information in making various scheduling decisions (e.g., task's execution deadline, time slice, etc). It consists of rust and BPF parts. The rust part simply loads the BPF scheduler and conducts the chores (e.g., printing statistics, etc). The BPF part makes all the scheduling decisions.