mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] cgroup: remove the superfluous judgment
@ 2022-05-18  1:36 Shida Zhang
  2022-05-19 12:33 ` Michal Koutný
  2022-05-20  7:50 ` Tejun Heo
  0 siblings, 2 replies; 3+ messages in thread
From: Shida Zhang @ 2022-05-18  1:36 UTC (permalink / raw)
  To: tj, lizefan.x, hannes; +Cc: zhangshida, starzhangzsd, linux-kernel, cgroups

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

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
---
 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


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

* Re: [PATCH v2] cgroup: remove the superfluous judgment
  2022-05-18  1:36 [PATCH v2] cgroup: remove the superfluous judgment Shida Zhang
@ 2022-05-19 12:33 ` Michal Koutný
  2022-05-20  7:50 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Koutný @ 2022-05-19 12:33 UTC (permalink / raw)
  To: Shida Zhang; +Cc: tj, lizefan.x, hannes, zhangshida, linux-kernel, cgroups

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

Reviewed-by: Michal Koutný <mkoutny@suse.com>

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

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

* Re: [PATCH v2] cgroup: remove the superfluous judgment
  2022-05-18  1:36 [PATCH v2] cgroup: remove the superfluous judgment Shida Zhang
  2022-05-19 12:33 ` Michal Koutný
@ 2022-05-20  7:50 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2022-05-20  7:50 UTC (permalink / raw)
  To: Shida Zhang; +Cc: lizefan.x, hannes, zhangshida, linux-kernel, cgroups

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 <tj@kernel.org>
> Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>

Applied to cgroup/for-5.19.

Thanks.

-- 
tejun

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

end of thread, other threads:[~2022-05-20  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18  1:36 [PATCH v2] cgroup: remove the superfluous judgment Shida Zhang
2022-05-19 12:33 ` Michal Koutný
2022-05-20  7:50 ` Tejun Heo

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®