sched_ext: Introduce NUMA awareness to the default idle selection policy
authorAndrea Righi <arighi@nvidia.com>
Tue, 29 Oct 2024 10:16:18 +0000 (11:16 +0100)
committerTejun Heo <tj@kernel.org>
Tue, 29 Oct 2024 19:36:35 +0000 (09:36 -1000)
commit860a45219bce09d9ebac883cfcf9b5b0b8a8a999
treec470385452f656cc7b782c612c0d5b855f936f34
parentb7d0bbcf0c9828dd6974f8c1ccbdf2e13f3ad73f
sched_ext: Introduce NUMA awareness to the default idle selection policy

Similarly to commit dfa4ed29b18c ("sched_ext: Introduce LLC awareness to
the default idle selection policy"), extend the built-in idle CPU
selection policy to also prioritize CPUs within the same NUMA node.

With this change applied, the built-in CPU idle selection policy follows
this logic:
 - always prioritize CPUs from fully idle SMT cores,
 - select the same CPU if possible,
 - select a CPU within the same LLC domain,
 - select a CPU within the same NUMA node.

Both NUMA and LLC awareness features are enabled only when the system
has multiple NUMA nodes or multiple LLC domains.

In the future, we may want to improve the NUMA node selection to account
the node distance from prev_cpu. Currently, the logic only tries to keep
tasks running on the same NUMA node. If all CPUs within a node are busy,
the next NUMA node is chosen randomly.

Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c