diff options
| author | Hui Su <sh_def@163.com> | 2026-10-12 02:31:00 +0900 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-10-12 08:42:13 -1000 |
| commit | 6ac4544eff796666ce6fbcc4be8181c81dfccc85 (patch) | |
| tree | 1e9d723d24d784b1daf143caa0a6d80b311f479b /tools/perf/scripts/python/libxed.py | |
| parent | 5bdeca322a6f8d10acaf67cccab1f69747ee7be3 (diff) | |
sched_ext: idle: Respect task affinity in restricted CPU selection
The restricted select_cpu kfunc path handles single-CPU and
migration-disabled tasks without going through scx_select_cpu_dfl().
It currently uses prev_cpu as the candidate, even though prev_cpu is only a
hint and may no longer be usable after an affinity change. With a
caller-provided @allowed mask, this can also return an idle CPU outside
p->cpus_ptr.
Derive the candidate from task state instead: use the sole CPU in
p->cpus_ptr for single-CPU tasks and task_cpu(p) for migration-disabled
tasks. Validate it against p->cpus_ptr and @allowed before claiming its
idle state.
Since the derived candidate may be on a different NUMA node from
prev_cpu, also preserve SCX_PICK_IDLE_IN_NODE by rejecting cross-node
candidates.
Perform all checks before scx_idle_test_and_clear_cpu(), as a successful
call consumes the CPU's idle bit.
Fixes: 683d2d0faba1 ("sched_ext: idle: Introduce scx_bpf_select_cpu_and()")
Cc: stable@vger.kernel.org
Signed-off-by: Hui Su <sh_def@163.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/libxed.py')
0 files changed, 0 insertions, 0 deletions
