Re: [PATCH v2] sched_ext: Reset cpuperf_target when a sub loses SCX_CAP_PERF or dies

From: Tejun Heo

Date: Tue Oct 06 2026 - 15:31:25 EST


Hello, Tao.

On Tue, Oct 06, 2026 at 10:28:34PM +0800, Tao Cui wrote:
> Fix it by restoring the neutral base that the root scheduler establishes
> at enable time, at every point where a writer loses the ability to
> write:

I don't think the kernel should be picking a value here. The cpuperf target
is last-writer-wins state with no owner tracking, and the only value the
kernel ever imposes is the initialization at enable. If a parent grants
SCX_CAP_PERF to a child, it should expect the child to have changed the
targets, and restoring them after a revoke or in ops.sub_detach() is the
parent's responsibility. The root holds every cap and a sub-sched parent
holds PERF wherever it could grant it, so the rewrite always has the cap.

There is a gap on the kernel side which makes that unreliable right now.
ops.sub_detach() runs before the child's ops.exit() and before the child
loses kfunc access, so a child timer or its ops.exit() can still write
after the parent has cleaned up. I'll post a patch which drops the dying
child's caps before ops.sub_detach() so that the child is inert by the time
the parent is notified.

Thanks.

--
tejun