summaryrefslogtreecommitdiffstats
path: root/include/linux/cgroup.h
diff options
context:
space:
mode:
authorTejun Heo2014-05-13 17:30:04 +0200
committerTejun Heo2014-05-13 17:30:04 +0200
commitf21a4f7594a122dcaabc08ce03bfb63fdc34de1b (patch)
treebdce189dc55f875e5466c31374c52b48f4ba4db0 /include/linux/cgroup.h
parentMerge branch 'for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/p... (diff)
parentcgroup: fix rcu_read_lock() leak in update_if_frozen() (diff)
downloadkernel-qcow2-linux-f21a4f7594a122dcaabc08ce03bfb63fdc34de1b.tar.gz
kernel-qcow2-linux-f21a4f7594a122dcaabc08ce03bfb63fdc34de1b.tar.xz
kernel-qcow2-linux-f21a4f7594a122dcaabc08ce03bfb63fdc34de1b.zip
Merge branch 'for-3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup into for-3.16
Pull to receive e37a06f10994 ("cgroup: fix the retry path of cgroup_mount()") to avoid unnecessary conflicts with planned cgroup_tree_mutex removal and also to be able to remove the temp fix added by 36c38fb7144a ("blkcg: use trylock on blkcg_pol_mutex in blkcg_reset_stats()") afterwards. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r--include/linux/cgroup.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 6ab3ee5d4a14..bde44618d8c2 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -521,6 +521,7 @@ struct cftype {
};
extern struct cgroup_root cgrp_dfl_root;
+extern struct css_set init_css_set;
static inline bool cgroup_on_dfl(const struct cgroup *cgrp)
{
@@ -751,6 +752,20 @@ static inline struct cgroup_subsys_state *task_css(struct task_struct *task,
return task_css_check(task, subsys_id, false);
}
+/**
+ * task_css_is_root - test whether a task belongs to the root css
+ * @task: the target task
+ * @subsys_id: the target subsystem ID
+ *
+ * Test whether @task belongs to the root css on the specified subsystem.
+ * May be invoked in any context.
+ */
+static inline bool task_css_is_root(struct task_struct *task, int subsys_id)
+{
+ return task_css_check(task, subsys_id, true) ==
+ init_css_set.subsys[subsys_id];
+}
+
static inline struct cgroup *task_cgroup(struct task_struct *task,
int subsys_id)
{