Re: [RFC PATCH] sched: Add scx_cpuperf_target in sched_cpu_util()

From: Qais Yousef

Date: Mon Mar 23 2026 - 21:36:27 EST


On 03/19/26 10:13, Xuewen Yan wrote:

> > Beside that, this sort of plug-and-play is a big concern. You picked up sched
> > ext and changed the behavior, then you'd need to get your thermal management to
> > work with that. Not retrospectively sprinkle these hacks around to force things
> > to work again.
>
> In fact, I had considered this issue even before sending this patch.
> Our initial fix was to modify the thermal subsystem specifically,
> in cpufreq_cooling.c, when SCX is enabled, we stopped calling
> sched_cpu_util() and instead used idle-time-based calculation to
> obtain CPU util.
>
> However, we later realized that sched_cpu_util() is used not only in
> cpufreq_cooling.c but also in dtpm_cpu.c.
> Since I’m not familiar with dtpm_cpu.c, I was hesitant to modify it.
> This led us to propose the current patch.
> Although scx_cpuperf_target may not accurately reflect the true CPU
> utilization, as Christian pointed out, it’s still better than having
> nothing at all.
>
> That’s exactly why I marked this patch as RFC, I wasn’t sure whether
> the proper fix should be in cpufreq_cooling.c or in sched_cpu_util().
> It now seems clear that modifying only sched_cpu_util() is
> insufficient. Ideally, we should also update cpufreq_cooling.c, since
> we cannot guarantee that all SCX BPF programs will provide an accurate
> cpuperf_target.
> I’ll submit a follow-up patch to modify cpufreq_cooling.c shortly.

The bigger picture problem is that sched_ext is not trustable. For something
that is critical as thermal management you'd have to bake it with your out of
tree sched_ext changes. The current system was designed to work together with
some assumptions, and by opting to sched_ext you're opting out of these in-tree
assumptions. User space scheduler can be used with a user space cpufreq
governor and a userspace thermal solutions; I don't think there are
restrictions to creating out of tree governors.

If you have a problem that needs to be fixed in the scheduler, perhaps we can
help with that ;-)

If you just want to go and do your own thing, perhaps you can go all the way
then and redo it all.