From: Tejun Heo <tj@kernel.org>
To: David Vernet <void@manifault.com>,
Andrea Righi <arighi@nvidia.com>,
Changwoo Min <changwoo@igalia.com>
Cc: sched-ext@lists.linux.dev, Emil Tsalapatis <emil@etsalapatis.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Koutny <mkoutny@suse.com>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Tejun Heo <tj@kernel.org>
Subject: [PATCHSET sched_ext/for-7.3] sched_ext: Cgroup migration and op delivery for sub-schedulers
Date: Fri, 17 Jul 2026 22:17:19 -1000 [thread overview]
Message-ID: <20260718081727.582037-1-tj@kernel.org> (raw)
Hello,
A task's sched must match its cgroup's: each sub-scheduler serves the
cgroup2 subtree it is attached to and the root scheduler serves the rest.
Cgroup migration currently breaks this. A task moved across a
sub-scheduler boundary keeps its old sched, leading to wrong-sched
scheduling and, once the stale sched is freed, a use-after-free. Cgroup
ops are also always delivered to the root scheduler no matter which sched
serves the cgroup.
This patchset makes both follow the sub-scheduler topology:
- cgroup gains a task migration notifier (0001). sched_ext uses it to
re-home tasks whose migration crosses a sched boundary: the destination
sched runs the fallible ops.init_task() before the migration commits,
so a rejection fails the cgroup.procs write (0002-0004).
- cgroup_init/exit and the knob ops are delivered to the sched each
task_group is on. The move ops go to the task's sched, only for
migrations that don't re-home it (0005).
- Sub-scheduler enable claims the subtree's cgroups from the parent and
disable returns them. A parent that fails to re-init a returned cgroup
fails in turn and the cgroups move up the chain, ending at the root
scheduler (0006).
- scx_qmap consumes cgroup weights through ops.cgroup_set_weight() and
gains fault injection modes to exercise the failure paths (0007-0008).
Verified with a trace-based suite on the demo scheduler covering op
delivery and routing, handover failures, multi-level punt chains, cgroup1
and stress.
Based on sched_ext/for-7.3 (7c2cd767705d).
Tejun Heo (8):
cgroup: Add cgroup_task_notifier and task migration events
sched_ext: Factor out scx_rehome_task() and scx_punt_task()
sched_ext: Relocate scx_cgroup_enabled
sched_ext: Re-home tasks on cgroup migration
sched_ext: Deliver cgroup ops to each task_group's sched
sched_ext: Hand over cgroups at sub-scheduler enable/disable
tools/sched_ext: scx_qmap - Consume cgroup weights through set_weight
tools/sched_ext: scx_qmap - Add init fault injection modes
Git tree: git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git scx-cgroup-migration
include/linux/cgroup.h | 26 +++
include/linux/sched/ext.h | 15 ++
kernel/cgroup/cgroup.c | 93 ++++++++-
kernel/sched/ext/ext.c | 247 +++++++++++++++++-------
kernel/sched/ext/internal.h | 44 ++++-
kernel/sched/ext/sub.c | 418 +++++++++++++++++++++++++++++++++++++----
tools/sched_ext/scx_qmap.bpf.c | 95 ++++++++--
tools/sched_ext/scx_qmap.c | 110 +----------
tools/sched_ext/scx_qmap.h | 5 +-
9 files changed, 819 insertions(+), 234 deletions(-)
--
tejun
next reply other threads:[~2026-07-18 8:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 8:17 Tejun Heo [this message]
2026-07-18 8:17 ` [PATCH 1/8] cgroup: Add cgroup_task_notifier and task migration events Tejun Heo
2026-07-18 8:17 ` [PATCH 2/8] sched_ext: Factor out scx_rehome_task() and scx_punt_task() Tejun Heo
2026-07-18 8:17 ` [PATCH 3/8] sched_ext: Relocate scx_cgroup_enabled Tejun Heo
2026-07-18 8:17 ` [PATCH 4/8] sched_ext: Re-home tasks on cgroup migration Tejun Heo
2026-07-18 8:17 ` [PATCH 5/8] sched_ext: Deliver cgroup ops to each task_group's sched Tejun Heo
2026-07-18 8:17 ` [PATCH 6/8] sched_ext: Hand over cgroups at sub-scheduler enable/disable Tejun Heo
2026-07-18 8:17 ` [PATCH 7/8] tools/sched_ext: scx_qmap - Consume cgroup weights through set_weight Tejun Heo
2026-07-18 8:17 ` [PATCH 8/8] tools/sched_ext: scx_qmap - Add init fault injection modes Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260718081727.582037-1-tj@kernel.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=cgroups@vger.kernel.org \
--cc=changwoo@igalia.com \
--cc=emil@etsalapatis.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=sched-ext@lists.linux.dev \
--cc=void@manifault.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.