From: JP Kobryn <inwardvessel@gmail.com>
To: Yosry Ahmed <yosry.ahmed@linux.dev>
Cc: tj@kernel.org, shakeel.butt@linux.dev, mkoutny@suse.com,
hannes@cmpxchg.org, akpm@linux-foundation.org,
linux-mm@kvack.org, cgroups@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH v5 2/5] cgroup: use separate rstat trees for each subsystem
Date: Fri, 9 May 2025 10:53:51 -0700 [thread overview]
Message-ID: <77ddbd18-894e-4187-a5b1-66e52deec980@gmail.com> (raw)
In-Reply-To: <aBsm22A8qWjGJgY9@google.com>
On 5/7/25 2:24 AM, Yosry Ahmed wrote:
> On Fri, May 02, 2025 at 05:12:19PM -0700, JP Kobryn wrote:
[..]
>> @@ -6101,6 +6087,8 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early)
>> } else {
>> css->id = cgroup_idr_alloc(&ss->css_idr, css, 1, 2, GFP_KERNEL);
>> BUG_ON(css->id < 0);
>> +
>> + BUG_ON(css_rstat_init(css));
>
> We call css_rstat_init() here for subsys css's that are not early
> initialized, and in cgroup_setup_root() self css's. We can probably move
> both calls into cgroup_init() as I mentioned earlier?
I think it should stay here for two reasons. The first is because it
must precede the call to online_css(). There is a stated assumption that
css->css_online() is called (within online_css()) "after cgrp
successfully completed all allocations" in the admin-guide. There is an
example of this assumption in memcg_cgroup_css_online() in which the
work for periodic flushing is enqueued. So if online_css() is called
before css_rstat_init() there would be a race between flushing and
initializing rstat for the css.
The second reason is that calling css_rstat_init() on a subsystem css
must also follow the call to init_and_link_css(), or else the css will
not have any subsystem association at the point of rstat init. It would
result in a subsystem css appearing to be the cgroup::self css since the
cgroup_subsys_state::ss field would be NULL.
>
> Also, I think this version just skips calling css_rstat_init() for early
> initialized subsys css's, without adding the patch that you talked about
> earlier which protects against early initialized subsystems using rstat.
>
Right, that was a pre-existing constraint but I'll create that patch and
prepend it to this series in the next rev.
next prev parent reply other threads:[~2025-05-09 17:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-03 0:12 [PATCH v5 0/5] cgroup: separate rstat trees JP Kobryn
2025-05-03 0:12 ` [PATCH v5 1/5] cgroup: use helper for distingushing css in callbacks JP Kobryn
2025-05-06 0:52 ` Shakeel Butt
2025-05-07 9:02 ` Yosry Ahmed
2025-05-09 21:46 ` JP Kobryn
2025-05-03 0:12 ` [PATCH v5 2/5] cgroup: use separate rstat trees for each subsystem JP Kobryn
2025-05-07 9:24 ` Yosry Ahmed
2025-05-09 17:53 ` JP Kobryn [this message]
2025-05-12 17:30 ` JP Kobryn
2025-05-03 0:12 ` [PATCH v5 3/5] cgroup: use subsystem-specific rstat locks to avoid contention JP Kobryn
2025-05-07 9:37 ` Yosry Ahmed
2025-05-03 0:12 ` [PATCH v5 4/5] cgroup: helper for checking rstat participation of css JP Kobryn
2025-05-07 9:38 ` Yosry Ahmed
2025-05-03 0:12 ` [PATCH v5 5/5] cgroup: document the rstat per-cpu initialization JP Kobryn
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=77ddbd18-894e-4187-a5b1-66e52deec980@gmail.com \
--to=inwardvessel@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=linux-mm@kvack.org \
--cc=mkoutny@suse.com \
--cc=shakeel.butt@linux.dev \
--cc=tj@kernel.org \
--cc=yosry.ahmed@linux.dev \
/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