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_bpfland: prevent per-CPU DSQ stall with per-CPU kthreads #755

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

arighi
Copy link
Contributor

@arighi arighi commented Oct 8, 2024

Since per-CPU kthreads may show an inconsistent prev_cpu and/or cpumask, dispatch them directly to local DSQ and allow to preempt the current running task.

This allows to prevent per-CPU kthread stalls and it also helps to prioritize them, as are usually important for system performance and responsiveness.

Moreover, change the behavior of --local-kthreads to prioritize all kthreads when this option is used.

This addresses issue #728.

NOTE: ideally we may want to fix this in the kernel by making sure to always expose a consistent prev_cpu and cpumask also for kthreads, but at the moment this change allows to prevent some annoying stalls and performance-wise it doesn't seem to introduce any regression. In fact, the usual gaming/fps benchmarks show even a slight improvement in responsiveness with this change applied.

Since per-CPU kthreads may show an inconsistent prev_cpu and/or cpumask,
dispatch them directly to local DSQ and allow to preempt the current
running task.

This allows to prevent per-CPU kthread stalls and it also helps to
prioritize them, as are usually important for system performance and
responsiveness.

Moreover, change the behavior of --local-kthreads to prioritize all
kthreads when this option is used.

This addresses issue #728.

NOTE: ideally we may want to fix this in the kernel by making sure to
always expose a consistent prev_cpu and cpumask also for kthreads, but
at the moment this change allows to prevent some annoying stalls and
performance-wise it doesn't seem to introduce any regression. In fact,
the usual gaming/fps benchmarks show even a slight improvement in
responsiveness with this change applied.

Thanks to YUBY from the CachyOS community for all the extremely valuable
help with the intensive stress tests.

Signed-off-by: Andrea Righi <[email protected]>
@arighi arighi force-pushed the bpfland-prevent-kthread-stall branch from 3009b49 to c8a9207 Compare October 8, 2024 13:04
Copy link
Contributor

@sirlucjan sirlucjan left a comment

Choose a reason for hiding this comment

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

Ive tested it, no more stalls.

@arighi arighi added scx_bpfland fix This is a bug fix labels Oct 8, 2024
@arighi arighi added this pull request to the merge queue Oct 8, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 8, 2024
@arighi arighi added this pull request to the merge queue Oct 9, 2024
Merged via the queue into main with commit e3e381d Oct 9, 2024
57 checks passed
@arighi arighi deleted the bpfland-prevent-kthread-stall branch October 9, 2024 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix This is a bug fix scx_bpfland
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants