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

Refactor select_cpu + enqueue for proper synchronization and handle of !wakeup #438

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dschatzberg
Copy link
Contributor

Two (significant) related commits here:

  1. refactor enqueue() so it works on !wakeup (where tasks bypass select_cpu)
  2. Fix the synchronization to actually ensure enqueue() has been invoked with some RCU-like pattern.

Missed this in some previous commits. Just running clang-format.

Signed-off-by: Dan Schatzberg <[email protected]>
If we're not on the wakeup path, we may see enqueue() invoked without
select_cpu() which will require an idle cpu lookup. In order to fix
this, we refactor the idle_cpu lookup in select_cpu so it can be invoked
from enqueue().

Signed-off-by: Dan Schatzberg <[email protected]>
scx_mitosis relied on the implicit assumption that after a sched tick,
all outstanding scheduling events had completed but this might not
actually be correct. This feels like a natural use-case for RCU, but
there is no way to directly make use of RCU in BPF. Instead, this commit
implements an RCU-like synchronization mechanism.

Signed-off-by: Dan Schatzberg <[email protected]>
@htejun
Copy link
Contributor

htejun commented Jul 18, 2024

I think it's lacking necessary memory barriers even on x86 as rmb isn't implied but this looks like a great starting point.

@htejun
Copy link
Contributor

htejun commented Oct 18, 2024

Is this PR still in progress?

@dschatzberg
Copy link
Contributor Author

dschatzberg commented Oct 19, 2024 via email

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.

3 participants