Merge branch 'for-4.5-ancestor-test' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup into for-4.5
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
@@ -81,7 +81,8 @@ struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgroup,
|
||||
struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
|
||||
struct cgroup_subsys *ss);
|
||||
|
||||
bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
|
||||
struct cgroup *cgroup_get_from_path(const char *path);
|
||||
|
||||
int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
|
||||
int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
|
||||
|
||||
@@ -361,6 +362,11 @@ static inline void css_put_many(struct cgroup_subsys_state *css, unsigned int n)
|
||||
percpu_ref_put_many(&css->refcnt, n);
|
||||
}
|
||||
|
||||
static inline void cgroup_put(struct cgroup *cgrp)
|
||||
{
|
||||
css_put(&cgrp->self);
|
||||
}
|
||||
|
||||
/**
|
||||
* task_css_set_check - obtain a task's css_set with extra access conditions
|
||||
* @task: the task to obtain css_set for
|
||||
@@ -468,6 +474,23 @@ static inline struct cgroup *task_cgroup(struct task_struct *task,
|
||||
return task_css(task, subsys_id)->cgroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* cgroup_is_descendant - test ancestry
|
||||
* @cgrp: the cgroup to be tested
|
||||
* @ancestor: possible ancestor of @cgrp
|
||||
*
|
||||
* Test whether @cgrp is a descendant of @ancestor. It also returns %true
|
||||
* if @cgrp == @ancestor. This function is safe to call as long as @cgrp
|
||||
* and @ancestor are accessible.
|
||||
*/
|
||||
static inline bool cgroup_is_descendant(struct cgroup *cgrp,
|
||||
struct cgroup *ancestor)
|
||||
{
|
||||
if (cgrp->root != ancestor->root || cgrp->level < ancestor->level)
|
||||
return false;
|
||||
return cgrp->ancestor_ids[ancestor->level] == ancestor->id;
|
||||
}
|
||||
|
||||
/* no synchronization, the result can only be used as a hint */
|
||||
static inline bool cgroup_is_populated(struct cgroup *cgrp)
|
||||
{
|
||||
|
Reference in New Issue
Block a user