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 yield-based preemption #274

Merged
merged 2 commits into from
May 10, 2024

Conversation

multics69
Copy link
Contributor

If there is a higher priority task when running ops.tick(), ops.select_cpu(), and ops.enqueue() callbacks, the current running tasks yields its CPU by shrinking time slice to zero and a higher priority task can run on the current CPU.

As low-cost, fine-grained preemption becomes available, default parameters are adjusted as follows:

  • Raise the bar for remote CPU preemption to avoid IPIs.
  • Increase the maximum time slice.
  • Gradually enforce the fair use of CPU time (i.e., ineligible duration)

Lastly, using CAS, we ensure that a remote CPU is preempted by only one CPU. This removes unnecessary remote preemptions (and IPIs).

If there is a higher priority task when running ops.tick(),
ops.select_cpu(), and ops.enqueue() callbacks, the current running tasks
yields its CPU by shrinking time slice to zero and a higher priority
task can run on the current CPU.

As low-cost, fine-grained preemption becomes available, default
parameters are adjusted as follows:
  - Raise the bar for remote CPU preemption to avoid IPIs.
  - Increase the maximum time slice.
  - Gradually enforce the fair use of CPU time (i.e., ineligible duration)

Lastly, using CAS, we ensure that a remote CPU is preempted by only one
CPU. This removes unnecessary remote preemptions (and IPIs).

Signed-off-by: Changwoo Min <[email protected]>
@multics69 multics69 requested review from htejun and Byte-Lab May 9, 2024 15:57
Copy link
Contributor

@htejun htejun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left minor comments. Looks great to me.

scheds/rust/scx_lavd/src/bpf/main.bpf.c Outdated Show resolved Hide resolved
scheds/rust/scx_lavd/src/bpf/main.bpf.c Outdated Show resolved Hide resolved
Signed-off-by: Changwoo Min <[email protected]>
@multics69 multics69 merged commit 01faf94 into sched-ext:main May 10, 2024
1 check passed
@multics69 multics69 deleted the scx-lavd-preemption02 branch May 10, 2024 02:32
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.

2 participants