Merge tag 'stackleak-v4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / include / linux / cgroup.h
index b8bcbdeb2eac428609da123c3f410806537ddae3..9968332cceed0e64e5fc9bdb814507b0bf67451b 100644 (file)
@@ -569,20 +569,11 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp,
 static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp,
                                             int ancestor_level)
 {
-       struct cgroup *ptr;
-
        if (cgrp->level < ancestor_level)
                return NULL;
-
-       for (ptr = cgrp;
-            ptr && ptr->level > ancestor_level;
-            ptr = cgroup_parent(ptr))
-               ;
-
-       if (ptr && ptr->level == ancestor_level)
-               return ptr;
-
-       return NULL;
+       while (cgrp && cgrp->level > ancestor_level)
+               cgrp = cgroup_parent(cgrp);
+       return cgrp;
 }
 
 /**
@@ -659,6 +650,11 @@ static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
        pr_cont_kernfs_path(cgrp->kn);
 }
 
+static inline struct psi_group *cgroup_psi(struct cgroup *cgrp)
+{
+       return &cgrp->psi;
+}
+
 static inline void cgroup_init_kthreadd(void)
 {
        /*
@@ -712,6 +708,16 @@ static inline union kernfs_node_id *cgroup_get_kernfs_id(struct cgroup *cgrp)
        return NULL;
 }
 
+static inline struct cgroup *cgroup_parent(struct cgroup *cgrp)
+{
+       return NULL;
+}
+
+static inline struct psi_group *cgroup_psi(struct cgroup *cgrp)
+{
+       return NULL;
+}
+
 static inline bool task_under_cgroup_hierarchy(struct task_struct *task,
                                               struct cgroup *ancestor)
 {