From: Chen Ridong <chenridong@huaweicloud.com>
To: "Michal Koutný" <mkoutny@suse.com>,
"Chen Ridong" <chenridong@huawei.com>
Cc: tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org,
longman@redhat.com, adityakali@google.com, sergeh@kernel.org,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 -next 1/3] cgroup/freezer: Reduce redundant traversal for cgroup_freeze
Date: Tue, 10 Sep 2024 10:39:25 +0800 [thread overview]
Message-ID: <98d20bd5-5b07-46c1-b098-0d883255484e@huaweicloud.com> (raw)
In-Reply-To: <quuw3s2y47l74ge54a43yjeaeoofqwg6ozofb3nwgvn55oj55p@o7bb5yrhvbj2>
On 2024/9/10 3:01, Michal Koutný wrote:
> On Thu, Sep 05, 2024 at 01:41:28PM GMT, Chen Ridong <chenridong@huawei.com> wrote:
>> Whether a cgroup is frozen is determined solely by whether it is set to
>> to be frozen and whether its parent is frozen. Currently, when is cgroup
>> is frozen or unfrozen, it iterates through the entire subtree to freeze
>> or unfreeze its descentdants.
>
> It's more to maintain the numeric freeze "layers".
>
>> However, this is unesessary for a cgroup that does not change its
>> effective frozen status.
>
> True.
>
>> +static inline void cgroup_update_efreeze(struct cgroup *cgrp)
>> +{
>> + struct cgroup *parent = cgroup_parent(cgrp);
>> + bool p_e = false;
>> +
>> + if (parent)
>> + p_e = parent->freezer.e_freeze;
>> +
>> + cgrp->freezer.e_freeze = cgrp->freezer.freeze | p_e;
>
> Better be || on bools
>
Thanks you, that is right.
> I'd open code this inside the loop of cgroup_freeze since it is not
> context-less function and it relies on top-down processing.
>
> Root cgrp cannot be frozen. You can bail out early in the beginning of
> cgroup_freeze() (possibly with a WARN_ON) and then assume parent is
> always valid when iterating.
>
'cgroup.freeze' is with CFTYPE_NOT_ON_ROOT tag, root cgroup will never
be frozen, considering root cgroup seems to be unesessary. I will open
the code inside the loop of cgroup_freeze in next patch.
Thanks
Ridong
> I think maintaining the e_freeze in this "saturated arithmetic" form is
> a sensible change.
>
> Thanks,
> Michal
next prev parent reply other threads:[~2024-09-10 2:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 13:41 [PATCH v1 -next 0/3] Some optimizations about freezer Chen Ridong
2024-09-05 13:41 ` [PATCH v1 -next 1/3] cgroup/freezer: Reduce redundant traversal for cgroup_freeze Chen Ridong
2024-09-09 19:01 ` Michal Koutný
2024-09-10 2:39 ` Chen Ridong [this message]
2024-09-05 13:41 ` [PATCH v1 -next 2/3] cgroup/freezer: Reduce redundant propagation for cgroup_propagate_frozen Chen Ridong
2024-09-09 19:02 ` Michal Koutný
2024-09-10 3:08 ` Chen Ridong
2024-09-10 11:33 ` Michal Koutný
2024-09-05 13:41 ` [PATCH v1 -next 3/3] cgroup/freezer: Add freeze selftest Chen Ridong
2024-09-09 19:03 ` Michal Koutný
2024-09-10 3:09 ` Chen Ridong
2024-09-09 19:04 ` [PATCH v1 -next 0/3] Some optimizations about freezer Michal Koutný
2024-09-10 3:16 ` Chen Ridong
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=98d20bd5-5b07-46c1-b098-0d883255484e@huaweicloud.com \
--to=chenridong@huaweicloud.com \
--cc=adityakali@google.com \
--cc=cgroups@vger.kernel.org \
--cc=chenridong@huawei.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=longman@redhat.com \
--cc=mkoutny@suse.com \
--cc=sergeh@kernel.org \
--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
all inboxes | Powered by JetHome®