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>
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);
css->flags &= ~CSS_VISIBLE;
- if (!css->ss) {
+ if (css_is_cgroup(css)) {
if (cgroup_on_dfl(cgrp)) {
cgroup_addrm_files(css, cgrp,
cgroup_base_files, false);
if (css->flags & CSS_VISIBLE)
return 0;
- if (!css->ss) {
+ if (css_is_cgroup(css)) {
if (cgroup_on_dfl(cgrp)) {
ret = cgroup_addrm_files(css, cgrp,
cgroup_base_files, true);