aboutsummaryrefslogtreecommitdiffstats
diff options
authorChangwoo Min <changwoo@igalia.com>2025-02-04 14:20:55 +0900
committerTejun Heo <tj@kernel.org>2025-02-04 10:36:47 -1000
commit9865f31d852a40e39b8efb8feec69182e1002489 (patch)
tree9d428ba73e48c36f65f45f853f0d7080e94e6c15
parentd46457c31c432b6b717dcaebab634d5126e2969a (diff)
downloadlinux-9865f31d852a40e39b8efb8feec69182e1002489.tar.gz
sched_ext: Add scx_bpf_events() and scx_read_event() for BPF schedulers
scx_bpf_events() is added to the header files so the BPF scheduler can use it. Also, scx_read_event() is added to read an event type in a compatible way. Signed-off-by: Changwoo Min <changwoo@igalia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--tools/sched_ext/include/scx/common.bpf.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/sched_ext/include/scx/common.bpf.h b/tools/sched_ext/include/scx/common.bpf.h
index f254a39b86a588..70554000302416 100644
--- a/tools/sched_ext/include/scx/common.bpf.h
+++ b/tools/sched_ext/include/scx/common.bpf.h
@@ -78,6 +78,10 @@ struct rq *scx_bpf_cpu_rq(s32 cpu) __ksym;
struct cgroup *scx_bpf_task_cgroup(struct task_struct *p) __ksym __weak;
u64 scx_bpf_now(void) __ksym __weak;
+void scx_bpf_events(struct scx_event_stats *events, size_t events__sz) __ksym __weak;
+#define scx_read_event(e, name) \
+ (bpf_core_field_exists((e)->name) ? (e)->name : 0)
+
/*
* Use the following as @it__iter when calling scx_bpf_dsq_move[_vtime]() from
* within bpf_for_each() loops.