summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJP Kobryn <inwardvessel@gmail.com>2025-05-15 03:19:33 +0300
committerTejun Heo <tj@kernel.org>2025-05-19 23:21:24 +0300
commit541a4219bd66bef56d93dbd306dc64a4d70ae99e (patch)
treed93048d2570693b3b235bda740e4e0cded0ac0ee /include
parentb2713a5ad396179e28bfbab892f3fcb9bdf04ce0 (diff)
downloadlinux-541a4219bd66bef56d93dbd306dc64a4d70ae99e.tar.xz
cgroup: compare css to cgroup::self in helper for distingushing css
Adjust the implementation of css_is_cgroup() so that it compares the given css to cgroup::self. Rename the function to css_is_self() in order to reflect that. Change the existing css->ss NULL check to a warning in the true branch. Finally, adjust call sites to use the new function name. Signed-off-by: JP Kobryn <inwardvessel@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/cgroup.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1f5b0a4a3356..989c08b09691 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -347,9 +347,15 @@ 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)
+static inline bool css_is_self(struct cgroup_subsys_state *css)
{
- return css->ss == NULL;
+ if (css == &css->cgroup->self) {
+ /* cgroup::self should not have subsystem association */
+ WARN_ON(css->ss != NULL);
+ return true;
+ }
+
+ return false;
}
static inline void cgroup_get(struct cgroup *cgrp)