[PATCHSET sched_ext/for-7.3-fixes] sched_ext: Idle repick notifications and online cid mask

From: Tejun Heo

Date: Mon Sep 14 2026 - 19:43:09 EST


Hello,

Two holes in the cid interface surfaced while converting a scheduler that
maintains its own idle and online tracking.

An idle CPU can be reserved and kicked without receiving a task. When it
picks idle again, the builtin idle masks recover the reservation but
ops.update_idle() is not called, so a scheduler tracking idle CPUs itself
can lose the CPU until another real transition. The first patch notifies on
idle-to-idle picks, automatically for cid-form schedulers and opt-in for
CPU-form ones.

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 and loading a cid-form scheduler that consumes both, by
local selftests covering the idle notification with and without the flag for
CPU-form and cid-form schedulers, and by a local selftest that offlines and
onlines a CPU in a VM and checks the mask and the callbacks at each step.

Based on sched_ext/for-7.3-fixes (c7a1c6e8004a).

This patchset contains the following 2 patches.

0001 sched_ext: Fix idle state tracking across idle repicks
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

diffstat follows. Thanks.

kernel/sched/ext/ext.c | 77 ++++++++++++++++++++++---
kernel/sched/ext/idle.c | 60 ++++++++++---------
kernel/sched/ext/internal.h | 24 +++++++-
kernel/sched/ext/sub.c | 10 ++--
tools/sched_ext/include/scx/common.bpf.h | 1 +
tools/sched_ext/include/scx/compat.h | 2 +
tools/sched_ext/include/scx/enum_defs.autogen.h | 1 +
tools/sched_ext/include/scx/enums_abi.autogen.h | 3 +-
8 files changed, 137 insertions(+), 41 deletions(-)

--
tejun