-
Notifications
You must be signed in to change notification settings - Fork 91
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_bpfland: introduce --lowlatency option #536
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sirlucjan
approved these changes
Aug 22, 2024
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.
❯ systemctl status scx
● scx.service - Start scx_scheduler
Loaded: loaded (/usr/lib/systemd/system/scx.service; enabled; preset: disabled)
Active: active (running) since Thu 2024-08-22 11:37:22 CEST; 1h 21min ago
Invocation: 49cc28cb6fd34bc7b2ee344058f1331e
Main PID: 54323 (scx_bpfland)
Tasks: 2 (limit: 37769)
Memory: 11.7M (peak: 18.9M)
CPU: 369ms
CGroup: /system.slice/scx.service
└─54323 scx_bpfland --lowlatency
sie 22 12:58:39 cachyos bash[54323]: 10:58:39 [INFO] [scx_bpfland] tasks -> run: 4/4 int: 1 wait: 8 | nvcsw: 3 | dispatch -> dir: 11076920 prio: 8574830 shr: 63675
sie 22 12:58:40 cachyos bash[54323]: 10:58:40 [INFO] [scx_bpfland] tasks -> run: 2/4 int: 1 wait: 7 | nvcsw: 3 | dispatch -> dir: 11076920 prio: 8576487 shr: 67132
sie 22 12:58:41 cachyos bash[54323]: 10:58:41 [INFO] [scx_bpfland] tasks -> run: 4/4 int: 1 wait: 7 | nvcsw: 8 | dispatch -> dir: 11076920 prio: 8577757 shr: 70390
sie 22 12:58:42 cachyos bash[54323]: 10:58:42 [INFO] [scx_bpfland] tasks -> run: 4/4 int: 1 wait: 9 | nvcsw: 6 | dispatch -> dir: 11076920 prio: 8580116 shr: 73552
sie 22 12:58:43 cachyos bash[54323]: 10:58:43 [INFO] [scx_bpfland] tasks -> run: 3/4 int: 2 wait: 8 | nvcsw: 6 | dispatch -> dir: 11076920 prio: 8582535 shr: 76798
sie 22 12:58:44 cachyos bash[54323]: 10:58:44 [INFO] [scx_bpfland] tasks -> run: 4/4 int: 1 wait: 8 | nvcsw: 8 | dispatch -> dir: 11076920 prio: 8584137 shr: 79877
sie 22 12:58:45 cachyos bash[54323]: 10:58:45 [INFO] [scx_bpfland] tasks -> run: 4/4 int: 1 wait: 8 | nvcsw: 8 | dispatch -> dir: 11076920 prio: 8586224 shr: 83010
sie 22 12:58:46 cachyos bash[54323]: 10:58:46 [INFO] [scx_bpfland] tasks -> run: 3/4 int: 2 wait: 10 | nvcsw: 8 | dispatch -> dir: 11076920 prio: 8587724 shr: 86406
sie 22 12:58:47 cachyos bash[54323]: 10:58:47 [INFO] [scx_bpfland] tasks -> run: 4/4 int: 1 wait: 8 | nvcsw: 3 | dispatch -> dir: 11076920 prio: 8589042 shr: 89807
sie 22 12:58:48 cachyos bash[54323]: 10:58:48 [INFO] [scx_bpfland] tasks -> run: 3/4 int: 1 wait: 7 | nvcsw: 4 | dispatch -> dir: 11076920 prio: 8590517 shr: 92993
I have been using for a few days, everything works without regression.
Tested-by: Piotr Gorski ([email protected])
Introduce the new `--lowlatency` option, which enables switching between the default pure vruntime-based scheduling (more optimized for server workloads) and a deadline-based scheduling (better suited for low-latency workloads). When the low-latency mode is activated, a task's deadline is calculated as its vruntime, adjusted by a bonus proportional to the task's average number of voluntary context switches (the more voluntary context switches, the shorter the deadline). This feature enhances the prioritization of interactive tasks even more, proportionally to their average voluntary context switches, also within the two main global queues (priority / shared) and it helps to maintain interactive workloads always responsive, even in presence of heavy non-interactive background work. Low-latency mode allows to prevent audio cracking even in presence of a large amount of short-lived tasks with pseudo-interactive behavior (i.e, hackbench) and it enables achieving approximately a +33% average frames-per-second (FPS) in the typical "gaming while building the kernel" benchmark. However, it can also amplify the de-prioritization of CPU-intensive tasks, making this option more suitable for specific low-latency scenarios. Therefore the low-latency mode is disabled by default and it can only be enabled via the `--lowlatency` option. Tested-by: Piotr Gorski ([email protected]) Signed-off-by: Andrea Righi <[email protected]>
arighi
force-pushed
the
bpfland-lowlatency-mode
branch
from
August 22, 2024 11:26
cf11483
to
6a22853
Compare
@sirlucjan thanks, added your tested-by line. |
htejun
approved these changes
Aug 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce the new
--lowlatency
option, which enables switching between the default pure vruntime-based scheduling (more optimized for server workloads) and a deadline-based scheduling (better suited for low-latency workloads).When the low-latency mode is activated, a task's deadline is calculated as its vruntime, adjusted by a bonus proportional to the task's average number of voluntary context switches (the more voluntary context switches, the shorter the deadline).
This feature enhances the prioritization of interactive tasks even more, proportionally to their average voluntary context switches, also within the two main global queues (priority / shared) and it helps to maintain interactive workloads always responsive, even in presence of heavy non-interactive background work.
Low-latency mode allows to prevent audio cracking even in presence of a large amount of short-lived tasks with pseudo-interactive behavior (i.e, hackbench) and it enables achieving approximately a +33% average frames-per-second (FPS) in the typical "gaming while building the kernel" benchmark.
However, it can also amplify the de-prioritization of CPU-intensive tasks, making this option more suitable for specific low-latency scenarios. Therefore the low-latency mode is disabled by default and it can only be enabled via the
--lowlatency
option.