Re: [PATCHSET v2 sched_ext/for-7.3-fixes] sched_ext: Idle claim recovery and online cid mask
From: Andrea Righi
Date: Tue Sep 15 2026 - 09:05:30 EST
Hi Tejun,
On Mon, Sep 14, 2026 at 10:27:23PM -1000, Tejun Heo wrote:
> Hello,
>
> v2: - Dropped the idle-to-idle notification patch. Restoring an unused idle
> claim from ops.dispatch() is the established pattern (Andrea Righi).
> Replaced with a patch fixing scx_qmap to do that and documenting the
> pattern in ops.update_idle().
> - Reworded the online cmask getter kerneldoc (Andrea Righi).
>
> v1: https://lore.kernel.org/r/20260914234259.3585373-1-tj@xxxxxxxxxx
>
> Two issues surfaced while converting a scheduler that maintains its own idle
> and online tracking.
>
> An idle CPU can be claimed and kicked without receiving a task. When it
> picks idle again there is no idle transition, so ops.update_idle() stays
> silent and a scheduler tracking idle CPUs itself loses the CPU until an
> unrelated task runs there. scx_qmap has this hole. The first patch restores
> the claim from ops.dispatch(), where a kick guarantees a call, and documents
> the pattern in ops.update_idle().
>
> A cid-form scheduler that installs its own mapping has no way to learn which
> cids are online: the online count identifies the set only under the default
> mapping and the CPU-form cpumask is unusable from cid programs. The second
> patch adds scx_bpf_online_cmask(), a kernel-maintained cmask in the
> scheduler's arena that follows the SCX hotplug notifications.
>
> Verified by building the kernel and tools/sched_ext and running scx_qmap
> under CPU and fork load in a VM. The online cmask patch only changed
> kerneldoc since v1, where a local selftest offlined and onlined a CPU in a
> VM and checked the mask and the callbacks at each step.
Looks good, for the series:
Reviewed-by: Andrea Righi <arighi@xxxxxxxxxx>
Thanks,
-Andrea
>
> Based on sched_ext/for-7.3-fixes (c7a1c6e8004a).
>
> This patchset contains the following 2 patches.
>
> 0001 sched_ext: scx_qmap: Restore unused idle claims from ops.dispatch()
> 0002 sched_ext: Maintain an online cid mask in the scheduler arena
>
> The patchset is also available in the following git branch:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git cid-online-cmask-v2
>
> diffstat follows. Thanks.
>
> kernel/sched/ext/ext.c | 75 +++++++++++++++++++++++++++++---
> kernel/sched/ext/internal.h | 9 +++-
> kernel/sched/ext/sub.c | 10 +++--
> tools/sched_ext/include/scx/common.bpf.h | 1 +
> tools/sched_ext/scx_qmap.bpf.c | 14 ++++--
> 5 files changed, 94 insertions(+), 15 deletions(-)
>
> --
> tejun