@@ -103,6 +103,8 @@ 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 *task_cgroup_from_root(struct task_struct *task,
+ struct cgroup_root *root);
int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
@@ -432,7 +434,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, \
@@ -444,6 +445,8 @@ extern spinlock_t css_set_lock;
rcu_dereference((task)->cgroups)
#endif
+extern struct mutex cgroup_mutex;
+
/**
* task_css_check - obtain css for (task, subsys) w/ extra access conds
* @task: the target task
@@ -99,7 +99,6 @@ struct cgroup_sb_opts {
bool none;
};
-extern struct mutex cgroup_mutex;
extern spinlock_t css_set_lock;
extern struct cgroup_subsys *cgroup_subsys[];
extern struct list_head cgroup_roots;
@@ -160,8 +159,6 @@ bool cgroup_is_thread_root(struct cgroup *cgrp);
bool cgroup_is_threaded(struct cgroup *cgrp);
struct cgroup_root *cgroup_root_from_kf(struct kernfs_root *kf_root);
-struct cgroup *task_cgroup_from_root(struct task_struct *task,
- struct cgroup_root *root);
struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline);
void cgroup_kn_unlock(struct kernfs_node *kn);
int cgroup_path_ns_locked(struct cgroup *cgrp, char *buf, size_t buflen,
@@ -69,8 +69,9 @@
* css_set_lock protects task->cgroups pointer, the list of css_set
* objects, and the chain of tasks off each css_set.
*
- * These locks are exported if CONFIG_PROVE_RCU so that accessors in
- * cgroup.h can use them for lockdep annotations.
+ * cgroup_mutex is always exported so that it may be taken by non-controller
+ * drivers. css_set_lock is exported if CONFIG_PROVE_RCU so that accessors in
+ * cgroup.h can use it for lockdep annotations.
*/
DEFINE_MUTEX(cgroup_mutex);
DEFINE_SPINLOCK(css_set_lock);
@@ -84,8 +85,8 @@ DEFINE_SPINLOCK(css_set_lock);
BLOCKING_NOTIFIER_HEAD(cgroup_destroy_notifier_list);
EXPORT_SYMBOL_GPL(cgroup_destroy_notifier_list);
-#ifdef CONFIG_PROVE_RCU
EXPORT_SYMBOL_GPL(cgroup_mutex);
+#ifdef CONFIG_PROVE_RCU
EXPORT_SYMBOL_GPL(css_set_lock);
#endif
@@ -1367,6 +1368,7 @@ struct cgroup *task_cgroup_from_root(struct task_struct *task,
*/
return cset_cgroup_from_root(task_css_set(task), root);
}
+EXPORT_SYMBOL(task_cgroup_from_root);
/*
* A task must hold cgroup_mutex to modify cgroups.
Drivers that handle processes on a per-cgroup basis need to be able to lookup the cgroup that a process belongs to. Cc: Tejun Heo <tj@kernel.org> Cc: cgroups@vger.kernel.org Signed-off-by: Matt Roper <matthew.d.roper@intel.com> --- include/linux/cgroup.h | 5 ++++- kernel/cgroup/cgroup-internal.h | 3 --- kernel/cgroup/cgroup.c | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-)