scx_mitosis: Drain ineligible tasks due to affinity restrictions#3668
Open
kkdwvd wants to merge 2 commits into
Open
scx_mitosis: Drain ineligible tasks due to affinity restrictions#3668kkdwvd wants to merge 2 commits into
kkdwvd wants to merge 2 commits into
Conversation
2a84b8f to
44ba238
Compare
We have cases where we queued tasks in cell DSQs with specific affinity masks that matched cpumask of the cell such that all_cell_cpus_allowed was true. Later, these cells may undergo rebalancing and lose CPUs on LLCs where such tasks are queued. Attempts to drain such tasks will continually fail due to affinity restrictions wrt CPUs trying to drain such tasks. In such cases, when a scx_bpf_dsq_move_to_local() consumption fails, we dispatch the task to an eligible per-CPU DSQ. In case the task undergoes affinity mask changes, it will undergo dequeue()/enqueue() cycle again. When such a task starts running, set all_cell_cpus_allowed=false for it to avoid updating its LLC, and invalidate the current selection. The call to maybe_refresh_cell() in the enqueue path will eventually fix any drift from the intended state of the task. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
44ba238 to
51a13a6
Compare
This file contains hidden or 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
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.
We have cases where we queued tasks in cell DSQs with specific affinity masks that matched cpumask of the cell such that all_cell_cpus_allowed was true. Later, these cells may undergo rebalancing and lose CPUs on LLCs where such tasks are queued. Attempts to drain such tasks will continually fail due to affinity restrictions wrt CPUs trying to drain such tasks.
In such cases, when a scx_bpf_dsq_move_to_local() consumption fails, we dispatch the task to an eligible per-CPU DSQ. In case the task undergoes affinity mask changes, it will undergo dequeue()/enqueue() cycle again.
When such a task starts running, set all_cell_cpus_allowed=false for it to avoid updating its LLC, and invalidate the current selection. The call to maybe_refresh_cell() in the enqueue path will eventually fix any drift from the intended state of the task.
The script reproduces the failure in absence of the fix, and verifies non-zero drain_affn_cnt in presence of it.