mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 23:04:43 +00:00
cgroup: misc changes
Misc trivial changes to prepare for future changes. No functional difference. * Expose cgroup_get(), cgroup_tryget() and cgroup_parent(). * Implement task_dfl_cgroup() which dereferences css_set->dfl_cgrp. * Rename cgroup_stats_show() to cgroup_stat_show() for consistency with the file name. Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
13d82fb77a
commit
3e48930cc7
2 changed files with 26 additions and 21 deletions
|
@ -398,6 +398,16 @@ 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_get(struct cgroup *cgrp)
|
||||
{
|
||||
css_get(&cgrp->self);
|
||||
}
|
||||
|
||||
static inline bool cgroup_tryget(struct cgroup *cgrp)
|
||||
{
|
||||
return css_tryget(&cgrp->self);
|
||||
}
|
||||
|
||||
static inline void cgroup_put(struct cgroup *cgrp)
|
||||
{
|
||||
css_put(&cgrp->self);
|
||||
|
@ -510,6 +520,20 @@ static inline struct cgroup *task_cgroup(struct task_struct *task,
|
|||
return task_css(task, subsys_id)->cgroup;
|
||||
}
|
||||
|
||||
static inline struct cgroup *task_dfl_cgroup(struct task_struct *task)
|
||||
{
|
||||
return task_css_set(task)->dfl_cgrp;
|
||||
}
|
||||
|
||||
static inline struct cgroup *cgroup_parent(struct cgroup *cgrp)
|
||||
{
|
||||
struct cgroup_subsys_state *parent_css = cgrp->self.parent;
|
||||
|
||||
if (parent_css)
|
||||
return container_of(parent_css, struct cgroup, self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* cgroup_is_descendant - test ancestry
|
||||
* @cgrp: the cgroup to be tested
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue