linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroup: Delete unnecessary if statement in css_visible()
@ 2020-08-29 10:03 Hao Lee
  2020-09-08 12:48 ` Hao Lee
  2020-10-01 14:44 ` Hao Lee
  0 siblings, 2 replies; 3+ messages in thread
From: Hao Lee @ 2020-08-29 10:03 UTC (permalink / raw)
  To: tj; +Cc: lizefan, hannes, cgroups, linux-kernel, haolee.swjtu

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cgroup: Delete unnecessary if statement in css_visible()
  2020-08-29 10:03 [PATCH] cgroup: Delete unnecessary if statement in css_visible() Hao Lee
@ 2020-09-08 12:48 ` Hao Lee
  2020-10-01 14:44 ` Hao Lee
  1 sibling, 0 replies; 3+ messages in thread
From: Hao Lee @ 2020-09-08 12:48 UTC (permalink / raw)
  To: tj; +Cc: lizefan, hannes, cgroups, linux-kernel

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@gmail.com>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cgroup: Delete unnecessary if statement in css_visible()
  2020-08-29 10:03 [PATCH] cgroup: Delete unnecessary if statement in css_visible() Hao Lee
  2020-09-08 12:48 ` Hao Lee
@ 2020-10-01 14:44 ` Hao Lee
  1 sibling, 0 replies; 3+ messages in thread
From: Hao Lee @ 2020-10-01 14:44 UTC (permalink / raw)
  To: tj; +Cc: lizefan, hannes, cgroups, linux-kernel

Hi, 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@gmail.com>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-01 14:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-29 10:03 [PATCH] cgroup: Delete unnecessary if statement in css_visible() Hao Lee
2020-09-08 12:48 ` Hao Lee
2020-10-01 14:44 ` Hao Lee

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).