scx_p2dq: Add L2 cluster-aware CPU selection#3114
Open
hodgesds wants to merge 3 commits intosched-ext:mainfrom
Open
scx_p2dq: Add L2 cluster-aware CPU selection#3114hodgesds wants to merge 3 commits intosched-ext:mainfrom
hodgesds wants to merge 3 commits intosched-ext:mainfrom
Conversation
39a308e to
8277399
Compare
Contributor
Author
|
Comparison: Optimized Cluster-Aware vs Baseline schbench Latency Test (2 threads × 16 messages, 30s) - 5 Run Average
Result: Near-identical performance with baseline in low-contention scenarios. stress-ng Cache Benchmark (60s, 316 workers)
Result: Significant cache performance improvement from L2 locality. stress-ng CPU Benchmark (60s, 316 workers)
Result: No CPU throughput regression. schbench High Load Test (8 threads × 32 messages, 30s)
Result: Improved performance under high contention. Key Findings ✅ Wins
|
Contributor
Author
|
clangd-format messed up some of the bpf code, will push a fix. |
67b95fd to
c824611
Compare
Detect L2 cache domains within LLCs by reading CPU cache topology from sysfs. This enables schedulers to make cache-aware placement decisions at a finer granularity than LLC. Signed-off-by: Daniel Hodges <hodgesd@meta.com>
Drop topo.all_clusters before iterating topo.all_cores to release Arc references. Clusters hold Arc references to cores, preventing Arc::into_inner() from succeeding during topology setup. Signed-off-by: Daniel Hodges <hodgesd@meta.com>
c824611 to
b14b678
Compare
oxyzenQ
approved these changes
Dec 2, 2025
Add L2 cluster awareness to improve cache locality by preferring CPUs within the same cluster before searching the wider LLC domain. Infrastructure: - Add cluster_id to cpu_ctx for per-CPU cluster tracking - Add has_clusters flag to topo_config - Initialize cluster_id for each CPU during BPF setup - Populate cluster IDs from topology in userspace Implementation: - Add pick_idle_cpu_in_cluster() helper to search cluster cpumask - Enhance pick_idle_cpu() to try cluster-level before LLC-level - Update wakeup paths for interactive tasks to prefer cluster - Check same-cluster waker/wakee before wider search This improves cache locality by keeping related tasks on CPUs sharing L2 cache, reducing cache misses and improving performance. Signed-off-by: Daniel Hodges <hodgesd@meta.com>
b14b678 to
5f7f1db
Compare
likewhatevs
approved these changes
Dec 2, 2025
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.
Add L2 cluster awareness to improve cache locality by preferring CPUs
within the same cluster before searching the wider LLC domain.
Infrastructure:
Implementation:
This improves cache locality by keeping related tasks on CPUs sharing
L2 cache, reducing cache misses and improving performance.