cgroup: Delete unnecessary if statement in css_visible()
PATCH 1/1 cgroup: Delete unnecessary if statement in css_visible()
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.
--- kernel/cgroup/cgroup.c | 2 -- 1 file changed, 2 deletions(-)
kernel/cgroup/cgroup.c +0 -2
@@ -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; }
Signature · 1 line
2.24.1
Hello,
ping
Quoted 31 lines · Hao Lee
css_visible()is called in eithercgroup_apply_control_enable()orcgroup_apply_control_disable().
Incgroup_apply_control_enable(), we have checkedss_maskbefore callingcss_visible(), so there is no need to do the same thing again. Incgroup_apply_control_disable():
- Ifcss->parentis not NULL, we have checkedss_maskin the second condition, so there is no need to do the same thing again.
- Ifcss->parentis 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 <[email protected]>--- kernel/cgroup/cgroup.c | 2 -- 1 file changed, 2 deletions(-)kernel/cgroup/cgroup.c +0
-2@@ -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; }Signature · 1 line
2.24.1
Hi, ping...
Quoted 31 lines · Hao Lee
css_visible()is called in eithercgroup_apply_control_enable()orcgroup_apply_control_disable().
Incgroup_apply_control_enable(), we have checkedss_maskbefore callingcss_visible(), so there is no need to do the same thing again. Incgroup_apply_control_disable():
- Ifcss->parentis not NULL, we have checkedss_maskin the second condition, so there is no need to do the same thing again.
- Ifcss->parentis 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 <[email protected]>--- kernel/cgroup/cgroup.c | 2 -- 1 file changed, 2 deletions(-)kernel/cgroup/cgroup.c +0
-2@@ -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; }Signature · 1 line
2.24.1