]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched_ext: idle: Introduce node-aware idle cpu kfunc helpers
authorAndrea Righi <arighi@nvidia.com>
Tue, 18 Feb 2025 18:04:41 +0000 (19:04 +0100)
committerTejun Heo <tj@kernel.org>
Tue, 18 Feb 2025 19:10:24 +0000 (09:10 -1000)
commit01059219b0cfdb9fc0d5bd60458e614a3135e6e7
treedf7701b0bc3e5af5658f7caf403670423b246a32
parent48849271e66114cb980a3bc44218b04d0f8cdcdd
sched_ext: idle: Introduce node-aware idle cpu kfunc helpers

Introduce a new kfunc to retrieve the node associated to a CPU:

 int scx_bpf_cpu_node(s32 cpu)

Add the following kfuncs to provide BPF schedulers direct access to
per-node idle cpumasks information:

 const struct cpumask *scx_bpf_get_idle_cpumask_node(int node)
 const struct cpumask *scx_bpf_get_idle_smtmask_node(int node)
 s32 scx_bpf_pick_idle_cpu_node(const cpumask_t *cpus_allowed,
  int node, u64 flags)
 s32 scx_bpf_pick_any_cpu_node(const cpumask_t *cpus_allowed,
         int node, u64 flags)

Moreover, trigger an scx error when any of the non-node aware idle CPU
kfuncs are used when SCX_OPS_BUILTIN_IDLE_PER_NODE is enabled.

Cc: Yury Norov [NVIDIA] <yury.norov@gmail.com>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Reviewed-by: Yury Norov [NVIDIA] <yury.norov@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext_idle.c
tools/sched_ext/include/scx/common.bpf.h
tools/sched_ext/include/scx/compat.bpf.h