diff options
| author | Andrea Righi <arighi@nvidia.com> | 2025-02-24 19:49:21 +0300 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2025-02-24 20:37:42 +0300 |
| commit | 0e9b4c10e833dbcfcdba63497463f1272c5efe4d (patch) | |
| tree | e1f09a4f9a45371d10f420796b9d96faf0aacaf8 /tools/sched_ext/include | |
| parent | 01059219b0cfdb9fc0d5bd60458e614a3135e6e7 (diff) | |
| download | linux-0e9b4c10e833dbcfcdba63497463f1272c5efe4d.tar.xz | |
sched_ext: idle: Introduce scx_bpf_nr_node_ids()
Similarly to scx_bpf_nr_cpu_ids(), introduce a new kfunc
scx_bpf_nr_node_ids() to expose the maximum number of NUMA nodes in the
system.
BPF schedulers can use this information together with the new node-aware
kfuncs, for example to create per-node DSQs, validate node IDs, etc.
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/sched_ext/include')
| -rw-r--r-- | tools/sched_ext/include/scx/common.bpf.h | 1 | ||||
| -rw-r--r-- | tools/sched_ext/include/scx/compat.bpf.h | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/tools/sched_ext/include/scx/common.bpf.h b/tools/sched_ext/include/scx/common.bpf.h index ca7cc4108b45..0e5587759090 100644 --- a/tools/sched_ext/include/scx/common.bpf.h +++ b/tools/sched_ext/include/scx/common.bpf.h @@ -70,6 +70,7 @@ void scx_bpf_dump_bstr(char *fmt, unsigned long long *data, u32 data_len) __ksym u32 scx_bpf_cpuperf_cap(s32 cpu) __ksym __weak; u32 scx_bpf_cpuperf_cur(s32 cpu) __ksym __weak; void scx_bpf_cpuperf_set(s32 cpu, u32 perf) __ksym __weak; +u32 scx_bpf_nr_node_ids(void) __ksym __weak; u32 scx_bpf_nr_cpu_ids(void) __ksym __weak; int scx_bpf_cpu_node(s32 cpu) __ksym __weak; const struct cpumask *scx_bpf_get_possible_cpumask(void) __ksym __weak; diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/include/scx/compat.bpf.h index 5a9bcdb52e79..266f94fe479b 100644 --- a/tools/sched_ext/include/scx/compat.bpf.h +++ b/tools/sched_ext/include/scx/compat.bpf.h @@ -189,6 +189,10 @@ static inline bool __COMPAT_is_enq_cpu_selected(u64 enq_flags) * * Preserve the following __COMPAT_scx_*_node macros until v6.17. */ +#define __COMPAT_scx_bpf_nr_node_ids() \ + (bpf_ksym_exists(scx_bpf_nr_node_ids) ? \ + scx_bpf_nr_node_ids() : 1U) + #define __COMPAT_scx_bpf_cpu_node(cpu) \ (bpf_ksym_exists(scx_bpf_cpu_node) ? \ scx_bpf_cpu_node(cpu) : 0) |
