2022-05-18 04:38:23

by Stephen Zhang

[permalink] [raw]
Subject: [PATCH v2] cgroup: remove the superfluous judgment

Remove the superfluous judgment since the function is
never called for a root cgroup, as suggested by Tejun.

Suggested-by: Tejun Heo <[email protected]>
Signed-off-by: Shida Zhang <[email protected]>
---
Changes from v1:
- Just remove the superfluous judgment instead.

kernel/cgroup/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index adb820e98f24..7d8a463c461b 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5685,7 +5685,7 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
css_clear_dir(&cgrp->self);
kernfs_remove(cgrp->kn);

- if (parent && cgroup_is_threaded(cgrp))
+ if (cgroup_is_threaded(cgrp))
parent->nr_threaded_children--;

spin_lock_irq(&css_set_lock);
--
2.25.1



2022-05-19 20:18:17

by Michal Koutný

[permalink] [raw]
Subject: Re: [PATCH v2] cgroup: remove the superfluous judgment

On Wed, May 18, 2022 at 09:36:47AM +0800, Shida Zhang <[email protected]> wrote:
> kernel/cgroup/cgroup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Michal Koutn? <[email protected]>

(Note to self, css_clear_dir() on root cgroup is not needed thanks to
kernfs_destroy_root()->kernfs_remove().)

2022-05-23 08:00:40

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH v2] cgroup: remove the superfluous judgment

On Wed, May 18, 2022 at 09:36:47AM +0800, Shida Zhang wrote:
> Remove the superfluous judgment since the function is
> never called for a root cgroup, as suggested by Tejun.
>
> Suggested-by: Tejun Heo <[email protected]>
> Signed-off-by: Shida Zhang <[email protected]>

Applied to cgroup/for-5.19.

Thanks.

--
tejun