-
Notifications
You must be signed in to change notification settings - Fork 39
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: support preemption (in some scenarios) #224
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
When a task is enqueued to the global queue, the scheduler checks if there is a lower priority task than the enqueued task. If so, it kicks out the lower-priority task, hoping the newly enqueued task or another higher-priority task runs on the kicked CPU. Kicking another CPU is expensive as an IPI is involved, so the scheduler judiciously kicks the CPU when its benefit (i.e., priority gap) is clear enough. Signed-off-by: Changwoo Min <changwoo@igalia.com>
When a system is overloaded so many tasks are waiting for execution, we stretch the time space to give more room to execute before the deadline. Signed-off-by: Changwoo Min <changwoo@igalia.com>
When a task is enqueued to the global queue, the scheduler checks if there is a lower priority task than the enqueued task. If so, it kicks out the lower-priority task, hoping the newly enqueued task or another higher-priority task runs on the kicked CPU. Kicking another CPU is expensive as an IPI is involved, so the scheduler judiciously kicks the CPU when its benefit (i.e., priority gap) is clear enough. Signed-off-by: Changwoo Min <changwoo@igalia.com>
When a system is overloaded so many tasks are waiting for execution, we stretch the time space to give more room to execute before the deadline. Signed-off-by: Changwoo Min <changwoo@igalia.com>
Signed-off-by: Changwoo Min <changwoo@igalia.com>
htejun
approved these changes
Apr 8, 2024
Approved but the commit history looks a bit off. Might be a good idea to clean up before landing? |
The most part of this commit is about refactoring the preemption code. The only functional change is adding nuance (i.e., cpu id) for the random traversal of CPUs for victim selection to be more random. Signed-off-by: Changwoo Min <changwoo@igalia.com>
Signed-off-by: Changwoo Min <changwoo@igalia.com>
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.
This PR implements preemption in scx_lavd. More specially, a task on scx_lavd can be kicked before its time slice is exhausted. The PR consists of two parts:
When a task is enqueued to the global DSQ, the scheduler checks if it is worth investing a preemption effort, and if so, it finds and kicks a victim CPU to run a more urgent task.
It monitors the system's current load. When overloaded, it lengthens the virtual deadline. It helps the system run smoothly when heavily overloaded.
Note that the current preemption logic very judiciously performs preemption since kicking a CPU is expensive.