Re: [PATCHSET v3 sched_ext/for-7.4] sched_ext: Report a sub-scheduler's ecaps on attach, detach and cpu hotplug

From: Andrea Righi

Date: Sun Oct 18 2026 - 05:20:03 EST


Hi Tejun,

On Sat, Oct 17, 2026 at 03:59:46PM -1000, Tejun Heo wrote:
> Hello,
>
> v3 (resched from irq work):
> - Reschedule the cpu for its queued ecaps syncs from hard irq work on that
> cpu instead of a kick. dispatch_one() processes the syncs only at its
> start, and a kick that lands while the pick has the rq lock dropped is
> cleared with the pick (#3, #5, sashiko).
> - Fix the SCX_RQ_ONLINE comments (#4) and why no report mark is pending at a
> suspend down (#6), and update comments and descriptions.
>
> v2 (detach and cpu hotplug):
> - Report the caps on detach as well as attach, and deliver regardless of
> bypass, which drops the replay at unbypass (#3).
> - Drop the sync_pcpu_ecaps() factoring. Add the cid_pshard() factoring and
> free a sub-scheduler a grace period after discarding its syncs (#1, #2).
> - Deliver only while the root has the cpu online, report the loss when a
> cpu goes offline, and leave suspend and hibernation out (#4-#6).
>
> v2: https://lore.kernel.org/r/20261017164556.4136807-1-tj@xxxxxxxxxx
> v1: https://lore.kernel.org/r/20261009094356.2852794-1-tj@xxxxxxxxxx
>
> A sub-scheduler learns which cids it holds through ops.sub_ecaps_updated(),
> but the grants its parent makes when it attaches are reported only after its
> enable bypass is lifted, which is also when its tasks are handed to it. So
> it gets its first ops.enqueue() calls before it has been notified of a
> single cid and has to hold the tasks somewhere until the grants arrive.
>
> The losses aren't reported either. The caps go away on detach and when a cpu
> goes offline without a delivery to the sub-scheduler or its parent. The
> reseed of a cpu coming back can also run their ops before the root's
> ops.cpu_online().
>
> With this patchset, a sub-scheduler's ecaps change only with the deliveries
> that report them. The attach-time caps are reported before bypass lifts, the
> loss on detach before any task goes back to the parent, and a cpu's loss and
> regain around the root's ops.cpu_offline() and ops.cpu_online(). Suspend
> and hibernation are left out: a cpu they take down keeps the caps last
> delivered, and the resume reports only the net change.
>
> Verified with sub-schedulers attaching and detaching with tasks queued and
> caps granted and revoked, through cpu hotplug with the races widened by
> debug patches and grants flooding a cpu as it goes down, on PREEMPT_RT as
> well, and across suspend. The protocol between the reports, the per-cpu
> syncs, cpu hotplug, suspend and the free path was model checked with TLC
> for small cpu counts.

For the whole series:

Reviewed-by: Andrea Righi <arighi@xxxxxxxxxx>

Thanks,
-Andrea