[Deepin-Kernel-SIG] [linux 6.18.y] [Upstream] sched_ext: idle: Prioritize idle SMT sibling#1743
Conversation
[Upstream commit 2197cecdb02c57b08340059452540fcf101fa30d] In the default built-in idle CPU selection policy, when @prev_cpu is busy and no fully idle core is available, try to place the task on its SMT sibling if that sibling is idle, before searching any other idle CPU in the same LLC. Migration to the sibling is cheap and keeps the task on the same core, preserving L1 cache and reducing wakeup latency. On large SMT systems this appears to consistently boost throughput by roughly 2-3% on CPU-bound workloads (running a number of tasks equal to the number of SMT cores). Cc: Cheng-Yang Chou <yphbchou0911@gmail.com> Signed-off-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
Reviewer's GuideThis PR updates the default sched_ext idle CPU selection policy to prefer scheduling on an idle SMT sibling of the previous CPU before searching other idle CPUs in the same LLC, and updates the documented selection steps accordingly. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Updates the default sched_ext built-in idle CPU selection policy to prefer waking/migrating onto an idle SMT sibling of prev_cpu before searching wider domains, aiming to keep work on the same physical core for better cache locality and lower wakeup latency.
Changes:
- Document the new selection step to prioritize
prev_cpu’s idle SMT sibling when no fully-idle core is available. - Add an SMT-sibling idle-CPU scan in
scx_select_cpu_dfl()before the LLC/NUMA idle searches.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /* | ||
| * Use @prev_cpu's sibling if it's idle. | ||
| */ | ||
| if (sched_smt_active()) { | ||
| for_each_cpu_and(cpu, cpu_smt_mask(prev_cpu), allowed) { | ||
| if (cpu == prev_cpu) | ||
| continue; | ||
| if (scx_idle_test_and_clear_cpu(cpu)) | ||
| goto out_unlock; | ||
| } | ||
| } |
|
commit 63f500c32a37d490ec623a3130e488cdb9bd6cf7 |
[Upstream commit 63f500c32a37d490ec623a3130e488cdb9bd6cf7]
Wrap cpu_smt_mask() usage with CONFIG_SCHED_SMT to avoid build failures
on kernels built without SMT support.
Fixes: 2197cecdb02c ("sched_ext: idle: Prioritize idle SMT sibling")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202603221422.XIueJOE9-lkp@intel.com/
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Reviewed-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Suggested-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
done |
[Upstream commit 2197cecdb02c57b08340059452540fcf101fa30d]
In the default built-in idle CPU selection policy, when @prev_cpu is busy and no fully idle core is available, try to place the task on its SMT sibling if that sibling is idle, before searching any other idle CPU in the same LLC.
Migration to the sibling is cheap and keeps the task on the same core, preserving L1 cache and reducing wakeup latency.
On large SMT systems this appears to consistently boost throughput by roughly 2-3% on CPU-bound workloads (running a number of tasks equal to the number of SMT cores).
Cc: Cheng-Yang Chou yphbchou0911@gmail.com
Summary by Sourcery
Enhancements: