]> Git Repo - linux.git/blobdiff - include/linux/cgroup.h
zstd: import usptream v1.5.2
[linux.git] / include / linux / cgroup.h
index b0914aa26506225c9e09af3a4d137209e053ac99..528bd44b59e2856a9bf25da0b25bc7bc37b3093a 100644 (file)
@@ -106,6 +106,7 @@ struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
 
 struct cgroup *cgroup_get_from_path(const char *path);
 struct cgroup *cgroup_get_from_fd(int fd);
+struct cgroup *cgroup_v1v2_get_from_fd(int fd);
 
 int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
 int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
@@ -433,6 +434,18 @@ static inline void cgroup_put(struct cgroup *cgrp)
        css_put(&cgrp->self);
 }
 
+extern struct mutex cgroup_mutex;
+
+static inline void cgroup_lock(void)
+{
+       mutex_lock(&cgroup_mutex);
+}
+
+static inline void cgroup_unlock(void)
+{
+       mutex_unlock(&cgroup_mutex);
+}
+
 /**
  * task_css_set_check - obtain a task's css_set with extra access conditions
  * @task: the task to obtain css_set for
@@ -447,7 +460,6 @@ static inline void cgroup_put(struct cgroup *cgrp)
  * as locks used during the cgroup_subsys::attach() methods.
  */
 #ifdef CONFIG_PROVE_RCU
-extern struct mutex cgroup_mutex;
 extern spinlock_t css_set_lock;
 #define task_css_set_check(task, __c)                                  \
        rcu_dereference_check((task)->cgroups,                          \
@@ -575,7 +587,7 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp,
 {
        if (cgrp->root != ancestor->root || cgrp->level < ancestor->level)
                return false;
-       return cgrp->ancestor_ids[ancestor->level] == cgroup_id(ancestor);
+       return cgrp->ancestors[ancestor->level] == ancestor;
 }
 
 /**
@@ -592,11 +604,9 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp,
 static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp,
                                             int ancestor_level)
 {
-       if (cgrp->level < ancestor_level)
+       if (ancestor_level < 0 || ancestor_level > cgrp->level)
                return NULL;
-       while (cgrp && cgrp->level > ancestor_level)
-               cgrp = cgroup_parent(cgrp);
-       return cgrp;
+       return cgrp->ancestors[ancestor_level];
 }
 
 /**
@@ -673,11 +683,6 @@ 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;
-}
-
 bool cgroup_psi_enabled(void);
 
 static inline void cgroup_init_kthreadd(void)
@@ -709,6 +714,8 @@ struct cgroup;
 static inline u64 cgroup_id(const struct cgroup *cgrp) { return 1; }
 static inline void css_get(struct cgroup_subsys_state *css) {}
 static inline void css_put(struct cgroup_subsys_state *css) {}
+static inline void cgroup_lock(void) {}
+static inline void cgroup_unlock(void) {}
 static inline int cgroup_attach_task_all(struct task_struct *from,
                                         struct task_struct *t) { return 0; }
 static inline int cgroupstats_build(struct cgroupstats *stats,
@@ -748,11 +755,6 @@ static inline bool task_under_cgroup_hierarchy(struct task_struct *task,
 
 static inline void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen)
 {}
-
-static inline struct cgroup *cgroup_get_from_id(u64 id)
-{
-       return NULL;
-}
 #endif /* !CONFIG_CGROUPS */
 
 #ifdef CONFIG_CGROUPS
This page took 0.043551 seconds and 4 git commands to generate.