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

Userland scheduler updates #63

Merged
merged 1 commit into from
Jan 3, 2024
Merged

Userland scheduler updates #63

merged 1 commit into from
Jan 3, 2024

Conversation

Byte-Lab
Copy link
Contributor

@Byte-Lab Byte-Lab commented Jan 2, 2024

This patch fixes a couple issues in the scx_rustland and scx_userland scheduler:

  • In scx_rustland, we keep using builtin idle tracking with SCX_OPS_KEEP_BUILTIN_IDLE to avoid racy checks in ops.select_cpu()
  • In scx_userland, we avoid hangs by using more robust checks to see if there's more work to be done in user space, and sending resched IPIs whenever there is.

@Byte-Lab Byte-Lab requested review from arighi and htejun January 2, 2024 20:20
Copy link
Collaborator

@arighi arighi left a comment

Choose a reason for hiding this comment

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

Reviewed and tested, LGTM!

The fact that we start to have some duplicate code between the BPF part of scx_rustland and scx_userland makes me think if we should introduce at some point a common "BPF abstraction" to provide the basic APIs to implement the user-space schedulers... something to think about for the future.

We can sometimes hit scenarios in the scx_userland scheduler where there
is work to be done in user space, but we incorrectly fail to run the
user space scheduler. In order to avoid this, we can use global
variables that are set from both BPF and user space. The BPF-side
variable reflects when one or more tasks have been enqueued, and the
user space-side variable reflects when user space has received tasks but
has not yet dispatched them.

In the ops.update_idle() callback, we can check these variables and send
a resched IPI to a core to ensure that the user-space scheduler is
always scheduled when there's work to be done.

Signed-off-by: David Vernet <void@manifault.com>
@htejun htejun merged commit 70088fd into main Jan 3, 2024
2 checks passed
@htejun htejun deleted the userland_updates branch January 10, 2024 19:51
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

3 participants