Merge tag 'for-linus-20181102' of git://git.kernel.dk/linux-block
[sfrench/cifs-2.6.git] / include / linux / cgroup.h
index 32c553556bbdc1c0d6f2db6c1fb86ddee6713367..9d12757a65b01846486341c5d31d398ee51d89b4 100644 (file)
@@ -567,20 +567,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;
 }
 
 /**
@@ -657,6 +648,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)
 {
        /*
@@ -710,6 +706,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)
 {