[PATCH 3/4] cgroup: simplify the cgroup descendant helper

From: Wei Yang
Date: Mon Oct 04 2021 - 04:49:43 EST


cgroup_for_each_live_descendant_[pre|post] use cgroup_css() to get the
root. While since the 2nd parameter is NULL, cgroup_css() always return
cgrp->self.

Let's simplify this a little.

Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
---
kernel/cgroup/cgroup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 570b0c97392a..457353aeb0ca 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -732,7 +732,7 @@ EXPORT_SYMBOL_GPL(of_css);

/* walk live descendants in pre order */
#define cgroup_for_each_live_descendant_pre(dsct, d_css, cgrp) \
- css_for_each_descendant_pre((d_css), cgroup_css((cgrp), NULL)) \
+ css_for_each_descendant_pre((d_css), &(cgrp)->self) \
if (({ lockdep_assert_held(&cgroup_mutex); \
(dsct) = (d_css)->cgroup; \
cgroup_is_dead(dsct); })) \
@@ -741,7 +741,7 @@ EXPORT_SYMBOL_GPL(of_css);

/* walk live descendants in postorder */
#define cgroup_for_each_live_descendant_post(dsct, d_css, cgrp) \
- css_for_each_descendant_post((d_css), cgroup_css((cgrp), NULL)) \
+ css_for_each_descendant_post((d_css), &(cgrp)->self) \
if (({ lockdep_assert_held(&cgroup_mutex); \
(dsct) = (d_css)->cgroup; \
cgroup_is_dead(dsct); })) \
--
2.23.0