From: "Michal Koutný" <mkoutny@suse.com>
To: Tejun Heo <tj@kernel.org>
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Zefan Li <lizefan.x@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH v2] cgroup: Reorganize css_set_lock and kernfs path processing
Date: Mon, 10 Oct 2022 10:22:34 +0200 [thread overview]
Message-ID: <Y0PWSlNmWT+1mkvB@blackbook> (raw)
In-Reply-To: <Yz21I9UpXafWMU0K@slm.duckdns.org>
On Wed, Oct 05, 2022 at 06:47:31AM -1000, Tejun Heo <tj@kernel.org> wrote:
> Hmm... isn't current's root cgrp guaranteed to be alive?
True on the default hierarchy. v1 hierarchies (singular ones with root
cgroup only) can be unmounted.
> How would cgroup_get_live() fail?
kill_sb is not synchronized via css_set_lock.
> Also, shouldn't cgroup_get() enough for path walking?
If ref count dropped to zero, release callback (css_release_work_fn)
would be queued, cgroup_get would increase the refcount but it won't
cancel this.
Note these were concerns with the first version of the patch that also touched
cgroup_show_path() (that processes v1 hierarchies too). With the
reduction I avoided this.
Strictly speaking, even css_set_lock is unnecessary around
current_cgns_cgroup_from_root() when called with cgrp_dfl_root as the
cset->cgrp_links is not traversed at all.
> If you really wanna do it this way, can you please add a detailed comment
> here why this is safe? But I'd prefer just doing a strightforward ref
> inc/dec around it.
I see the the extraction under css_set_lock without inc/dec turns out
confusing. Let me expand the idea above and avoid css_set_lock
completely (another message).
Michal
next prev parent reply other threads:[~2022-10-10 8:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 17:09 [PATCH] cgroup: Reorganize css_set_lock and kernfs path processing Michal Koutný
2022-09-06 17:13 ` Tejun Heo
2022-09-28 11:33 ` [PATCH v2] " Michal Koutný
2022-10-05 16:47 ` Tejun Heo
2022-10-10 8:22 ` Michal Koutný [this message]
2022-10-10 8:29 ` [PATCH v3] " Michal Koutný
2022-10-10 20:24 ` 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=Y0PWSlNmWT+1mkvB@blackbook \
--to=mkoutny@suse.com \
--cc=cgroups@vger.kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=tj@kernel.org \
/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