summaryrefslogtreecommitdiff
path: root/include/linux/cgroup.h
diff options
context:
space:
mode:
authorJP Kobryn <inwardvessel@gmail.com>2025-04-04 04:10:47 +0300
committerTejun Heo <tj@kernel.org>2025-04-04 23:01:22 +0300
commit845a7245801142bfff411bc84afa8cdbc789562f (patch)
tree3716896b30a44aef7389d5551c68dccd5d3e7111 /include/linux/cgroup.h
parentf6e9a26e2d488c743757d66898ae91c53ffbe528 (diff)
downloadlinux-845a7245801142bfff411bc84afa8cdbc789562f.tar.xz
cgroup: add helper for checking when css is cgroup::self
The cgroup struct has a css field called "self". The main difference between this css and the others found in the cgroup::subsys array is that cgroup::self has a NULL subsystem pointer. There are several places where checks are performed to determine whether the css in question is cgroup::self or not. Instead of accessing css->ss directly, introduce a helper function that shows the intent and use where applicable. Signed-off-by: JP Kobryn <inwardvessel@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r--include/linux/cgroup.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index e7da3c3b098b..65d95bb2199f 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -347,6 +347,11 @@ static inline bool css_is_dying(struct cgroup_subsys_state *css)
return css->flags & CSS_DYING;
}
+static inline bool css_is_cgroup(struct cgroup_subsys_state *css)
+{
+ return css->ss == NULL;
+}
+
static inline void cgroup_get(struct cgroup *cgrp)
{
css_get(&cgrp->self);