From: Tejun Heo <tj@kernel.org>
To: Hu Xinyao <huxinyao@kylinsec.com.cn>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Koutny <mkoutny@suse.com>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cgroup: Publish css ID after online_css() succeeds in css_create()
Date: Tue, 01 Dec 2026 04:15:12 -1000 [thread overview]
Message-ID: <d9264c1dcd5bdd55b693a050aeea1b33@kernel.org> (raw)
In-Reply-To: <25ABE1D5225B64B1+1796116222.35099.6566-huxinyao@kylinsec.com.cn>
Hello, Xinyao.
On Tue, Dec 01, 2026 at 06:10:22PM +0900, Hu Xinyao wrote:
> None of the subsystem ->css_online() callbacks look up the new css via
> ss->css_idr, and css->id itself is already assigned by
> cgroup_idr_alloc(). Move cgroup_idr_replace(&ss->css_idr, css, css->id)
> to after online_css(css) succeeds so a failed css_create() keeps the
> IDR slot as NULL until css_free_rwork_fn() removes the ID reservation.
The ordering is intentional. A css should become visible to iteration and
ID lookups before it goes online and stay visible while it's online. With
this change, a css which is already online can't be found by its ID for a
while.
This means that both iteration and ID lookups can yield a css which isn't
online, and the users need to be able to handle that. AFAICS, the problem
here is that the failure path of css_create() frees the css without
honoring its refcnt. Maybe the failure path should honor the refcnt like
the regular destruction path does?
Thanks.
--
tejun
prev parent reply other threads:[~2026-12-01 14:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 9:10 Hu Xinyao
2026-12-01 14:15 ` Tejun Heo [this message]
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=d9264c1dcd5bdd55b693a050aeea1b33@kernel.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=huxinyao@kylinsec.com.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=mkoutny@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®