Skip to content
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 8 commits into from
Apr 9, 2024

Conversation

multics69
Copy link
Contributor

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:

  1. 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.

  2. 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.

Changwoo Min added 6 commits April 8, 2024 11:31
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
Copy link
Contributor

htejun commented Apr 8, 2024

Approved but the commit history looks a bit off. Might be a good idea to clean up before landing?

Changwoo Min added 2 commits April 9, 2024 12:06
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>
@multics69 multics69 marked this pull request as ready for review April 9, 2024 05:13
@multics69 multics69 merged commit f53c297 into sched-ext:main Apr 9, 2024
1 check passed
@multics69 multics69 deleted the scx-lavd-kick branch April 9, 2024 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants