public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH sched_ext/for-7.1] tools/sched_ext: Add __COMPAT wrapper for scx_bpf_sub_dispatch()
       [not found] <20260322144433.1649092-1-yphbchou0911@gmail.com>
@ 2026-03-22 20:12 ` Tejun Heo
  2026-03-23 12:53   ` Cheng-Yang Chou
  0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2026-03-22 20:12 UTC (permalink / raw)
  To: Cheng-Yang Chou, sched-ext, David Vernet, Andrea Righi,
	Changwoo Min
  Cc: Ching-Chun Huang, Chia-Ping Tsai, Emil Tsalapatis, linux-kernel

Hello,

Let's not use the __COMPAT prefix. I'd like to move toward making compat
wrappers transparent so that schedulers don't need code changes for
compatibility as much as reasonably possible.

Instead, declare the kfunc with a ___compat suffix and provide a static
inline wrapper with the original name, like scx_bpf_dsq_insert() does:

  bool scx_bpf_sub_dispatch___compat(u64 cgroup_id) __ksym __weak;

  static inline bool scx_bpf_sub_dispatch(u64 cgroup_id)
  {
  	if (bpf_ksym_exists(scx_bpf_sub_dispatch___compat))
  		return scx_bpf_sub_dispatch___compat(cgroup_id);
  	return false;
  }

See tools/sched_ext/include/scx/compat.bpf.h around line 326-342 for the
full pattern.

This way schedulers just call scx_bpf_sub_dispatch() directly and the
compat layer handles everything. The no-op fallback (returning false) is
fine here since without sub-sched support the dispatch path can't do
anything useful anyway.

Thanks.

--
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH sched_ext/for-7.1] tools/sched_ext: Add __COMPAT wrapper for scx_bpf_sub_dispatch()
  2026-03-22 20:12 ` [PATCH sched_ext/for-7.1] tools/sched_ext: Add __COMPAT wrapper for scx_bpf_sub_dispatch() Tejun Heo
@ 2026-03-23 12:53   ` Cheng-Yang Chou
  0 siblings, 0 replies; 2+ messages in thread
From: Cheng-Yang Chou @ 2026-03-23 12:53 UTC (permalink / raw)
  To: Tejun Heo
  Cc: sched-ext, David Vernet, Andrea Righi, Changwoo Min,
	Ching-Chun Huang, Chia-Ping Tsai, Emil Tsalapatis, linux-kernel

On Sun, Mar 22, 2026 at 10:12:29AM -1000, Tejun Heo wrote:
> Hello,
> 
> Let's not use the __COMPAT prefix. I'd like to move toward making compat
> wrappers transparent so that schedulers don't need code changes for
> compatibility as much as reasonably possible.

I think this might be another good first issue for me to tackle next :-)
I'll keep the v2 patch focused only on the scx_bpf_sub_dispatch() change,
and then I can go on to take a look at refactoring the rest of these 
__COMPAT wrappers.

> 
> Instead, declare the kfunc with a ___compat suffix and provide a static
> inline wrapper with the original name, like scx_bpf_dsq_insert() does:
> 
>   bool scx_bpf_sub_dispatch___compat(u64 cgroup_id) __ksym __weak;
> 
>   static inline bool scx_bpf_sub_dispatch(u64 cgroup_id)
>   {
>   	if (bpf_ksym_exists(scx_bpf_sub_dispatch___compat))
>   		return scx_bpf_sub_dispatch___compat(cgroup_id);
>   	return false;
>   }
> 
> See tools/sched_ext/include/scx/compat.bpf.h around line 326-342 for the
> full pattern.
> 
> This way schedulers just call scx_bpf_sub_dispatch() directly and the
> compat layer handles everything. The no-op fallback (returning false) is
> fine here since without sub-sched support the dispatch path can't do
> anything useful anyway.

Got it.
I'll send a v2 patch implementing this approach.

-- 
Thanks,
Cheng-Yang

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-23 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260322144433.1649092-1-yphbchou0911@gmail.com>
2026-03-22 20:12 ` [PATCH sched_ext/for-7.1] tools/sched_ext: Add __COMPAT wrapper for scx_bpf_sub_dispatch() Tejun Heo
2026-03-23 12:53   ` Cheng-Yang Chou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox