From: Tejun Heo <tj@kernel.org>
To: "Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Petr Malat <oss@malat.biz>, Bert Karwatzki <spasswolf@web.de>,
kernel test robot <oliver.sang@intel.com>,
Martin Pitt <martin@piware.de>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Tejun Heo <tj@kernel.org>
Subject: [PATCHSET cgroup/for-7.2] cgroup: Per-css kill_css_finish deferral
Date: Mon, 4 May 2026 14:51:16 -1000 [thread overview]
Message-ID: <20260505005121.1230198-1-tj@kernel.org> (raw)
Hello,
Follow-up to 93618edf7538 ("cgroup: Defer css percpu_ref kill on rmdir
until cgroup is depopulated") in cgroup/for-7.1-fixes, assumed merged
into cgroup/for-7.2.
That commit fixed the rmdir race by deferring kill_css_finish() at the
cgroup level so ->css_offline() runs only after PF_EXITING tasks have
left the cgroup. cgroup_apply_control_disable() has the same race shape
(PF_EXITING tasks pinning the dying controller's css while
->css_offline() runs), but fixing it requires switching
cgroup_lock_and_drain_offline()'s wait predicate from
percpu_ref_is_dying() to css_is_dying() to cover the deferral window -
too invasive for -stable, hence -7.2.
This series:
- Replaces the cgroup-level deferral with a per-subsys-css mechanism
so each controller css independently defers kill_css_finish() until
its own subtree drains.
- Pairs smp_mb()s in kill_css_sync() and css_update_populated() to
interlock the synchronous- and deferred-fire decisions.
- Wires cgroup_apply_control_disable() through the per-css deferral
and switches drain_offline to wait on css_is_dying.
After the predicate switch, a +ctrl re-enable issued while a deferred
-ctrl is still draining blocks in TASK_UNINTERRUPTIBLE on offline_waitq
until the dying css drains. Pre-existing for rmdir; the apply path now
joins it.
Verified by 200001 iterations of repro-a72f73c4dd9b, per-commit
deterministic repros for the bug-chain commits, 5292 iterations of
stress-disable-control, and targeted ftrace coverage of rmdir,
apply_disable, and nested-destroy paths. No warnings or stalls.
Based on cgroup/for-7.2 (d8769544bde5) with cgroup/for-7.1-fixes
(93618edf7538) assumed merged.
Patches:
[PATCH 1/5] cgroup: Inline cgroup_has_tasks() in cgroup.h
[PATCH 2/5] cgroup: Annotate unlocked nr_populated_* accesses with READ_ONCE/WRITE_ONCE
[PATCH 3/5] cgroup: Move populated counters to cgroup_subsys_state
[PATCH 4/5] cgroup: Add per-subsys-css kill_css_finish deferral
[PATCH 5/5] cgroup: Defer kill_css_finish() in cgroup_apply_control_disable()
Git tree: git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git cgroup-drain-for-7.2
include/linux/cgroup-defs.h | 30 ++++---
include/linux/cgroup.h | 27 ++++++-
kernel/cgroup/cgroup.c | 188 +++++++++++++++++++++++++-------------------
kernel/cgroup/cpuset-v1.c | 2 +-
kernel/cgroup/cpuset.c | 2 +-
5 files changed, 148 insertions(+), 101 deletions(-)
Thanks.
--
tejun
next reply other threads:[~2026-05-05 0:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 0:51 Tejun Heo [this message]
2026-05-05 0:51 ` [PATCH 1/5] cgroup: Inline cgroup_has_tasks() in cgroup.h Tejun Heo
2026-05-05 0:51 ` [PATCH 2/5] cgroup: Annotate unlocked nr_populated_* accesses with READ_ONCE/WRITE_ONCE Tejun Heo
2026-05-05 0:51 ` [PATCH 3/5] cgroup: Move populated counters to cgroup_subsys_state Tejun Heo
2026-05-05 0:51 ` [PATCH 4/5] cgroup: Add per-subsys-css kill_css_finish deferral Tejun Heo
2026-05-05 0:51 ` [PATCH 5/5] cgroup: Defer kill_css_finish() in cgroup_apply_control_disable() 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=20260505005121.1230198-1-tj@kernel.org \
--to=tj@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin@piware.de \
--cc=mkoutny@suse.com \
--cc=oliver.sang@intel.com \
--cc=oss@malat.biz \
--cc=spasswolf@web.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox