From: Hao Lee <haolee.swjtu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] cgroup: Delete unnecessary if statement in css_visible()
Date: Tue, 8 Sep 2020 12:48:52 +0000 [thread overview]
Message-ID: <20200908124852.GB22780@haolee.github.io> (raw)
In-Reply-To: <20200829100202.GA855-aLGwGs2JoHKXlosIQRE7iA@public.gmane.org>
Hello,
ping
On Sat, Aug 29, 2020 at 10:03:16AM +0000, Hao Lee wrote:
> css_visible() is called in either cgroup_apply_control_enable()
> or cgroup_apply_control_disable().
> In cgroup_apply_control_enable(), we have checked ss_mask before calling
> css_visible(), so there is no need to do the same thing again.
> In cgroup_apply_control_disable():
> - If css->parent is not NULL, we have checked ss_mask in the
> second condition, so there is no need to do the same thing again.
> - If css->parent is NULL, dsct is root cgroup so the deleted if
> statement is always false and there is no need to keep it.
>
> Signed-off-by: Hao Lee <haolee.swjtu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> kernel/cgroup/cgroup.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index dd247747ec14..b6714166106d 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -3023,8 +3023,6 @@ static bool css_visible(struct cgroup_subsys_state *css)
>
> if (cgroup_control(cgrp) & (1 << ss->id))
> return true;
> - if (!(cgroup_ss_mask(cgrp) & (1 << ss->id)))
> - return false;
> return cgroup_on_dfl(cgrp) && ss->implicit_on_dfl;
> }
>
> --
> 2.24.1
>
next prev parent reply other threads:[~2020-09-08 12:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-29 10:03 [PATCH] cgroup: Delete unnecessary if statement in css_visible() Hao Lee
[not found] ` <20200829100202.GA855-aLGwGs2JoHKXlosIQRE7iA@public.gmane.org>
2020-09-08 12:48 ` Hao Lee [this message]
2020-10-01 14:44 ` Hao Lee
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=20200908124852.GB22780@haolee.github.io \
--to=haolee.swjtu-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).