Re: [PATCH sched_ext/for-7.1] tools/sched_ext: Add compat handling for sub-scheduler ops

From: Cheng-Yang Chou

Date: Sat Mar 21 2026 - 13:17:37 EST


Hi Andrea,

On Sat, Mar 21, 2026 at 11:20:36AM +0100, Andrea Righi wrote:
> + * - v7.1: ops.sub_attach(), ops.sub_detach()

Do we also want to handle sub_cgroup_id in this compat block for older
kernels?

> */
> #define SCX_OPS_OPEN(__ops_name, __scx_name) ({ \
> struct __scx_name *__skel; \
> @@ -181,6 +182,16 @@ static inline long scx_hotplug_seq(void)
> fprintf(stderr, "WARNING: kernel doesn't support ops.cgroup_set_idle()\n"); \
> __skel->struct_ops.__ops_name->cgroup_set_idle = NULL; \
> } \
> + if (__skel->struct_ops.__ops_name->sub_attach && \
> + !__COMPAT_struct_has_field("sched_ext_ops", "sub_attach")) { \
> + fprintf(stderr, "WARNING: kernel doesn't support ops.sub_attach()\n"); \
> + __skel->struct_ops.__ops_name->sub_attach = NULL; \
> + } \
> + if (__skel->struct_ops.__ops_name->sub_detach && \
> + !__COMPAT_struct_has_field("sched_ext_ops", "sub_detach")) { \
> + fprintf(stderr, "WARNING: kernel doesn't support ops.sub_detach()\n"); \
> + __skel->struct_ops.__ops_name->sub_detach = NULL; \
> + } \
> __skel; \
> })
>
> --
> 2.53.0
>

Overall looks good.

--
Thanks,
Cheng-Yang