summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2026-03-08 05:45:17 +0300
committerTejun Heo <tj@kernel.org>2026-03-08 11:45:12 +0300
commitc9c8546cdee64d3f1a54fe09cc2b8c1a8ea80c6d (patch)
tree08164a7222f8a715549860910051a84ae87df2d6
parent3691d380d5ca8c847c716327aad73a07307ec9c4 (diff)
downloadlinux-c9c8546cdee64d3f1a54fe09cc2b8c1a8ea80c6d.tar.xz
tools/sched_ext/include: Add __COMPAT_HAS_scx_bpf_select_cpu_and macro
scx_bpf_select_cpu_and() is now an inline wrapper so bpf_ksym_exists(scx_bpf_select_cpu_and) no longer works. Add __COMPAT_HAS_scx_bpf_select_cpu_and macro that checks for either the struct args type (new) or the compat ksym (old) to test availability. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Andrea Righi <arighi@nvidia.com>
-rw-r--r--tools/sched_ext/include/scx/compat.bpf.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/include/scx/compat.bpf.h
index 2d3985be7e2c..704728864d83 100644
--- a/tools/sched_ext/include/scx/compat.bpf.h
+++ b/tools/sched_ext/include/scx/compat.bpf.h
@@ -266,6 +266,14 @@ scx_bpf_select_cpu_and(struct task_struct *p, s32 prev_cpu, u64 wake_flags,
}
}
+/*
+ * scx_bpf_select_cpu_and() is now an inline wrapper. Use this instead of
+ * bpf_ksym_exists(scx_bpf_select_cpu_and) to test availability.
+ */
+#define __COMPAT_HAS_scx_bpf_select_cpu_and \
+ (bpf_core_type_exists(struct scx_bpf_select_cpu_and_args) || \
+ bpf_ksym_exists(scx_bpf_select_cpu_and___compat))
+
/**
* scx_bpf_dsq_insert_vtime - Insert a task into the vtime priority queue of a DSQ
* @p: task_struct to insert