mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
cgroup: relocate cgroup_lock_live_group() and cgroup_attach_task_all()
cgroup_lock_live_group() and cgroup_attach_task() are scheduled to be made static. Relocate the former and cgroup_attach_task_all() so that we don't need forward declarations. This patch is pure relocation. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
This commit is contained in:
parent
8cc9934520
commit
7ae1bad99e
@ -329,6 +329,24 @@ static inline struct cftype *__d_cft(struct dentry *dentry)
|
|||||||
return __d_cfe(dentry)->type;
|
return __d_cfe(dentry)->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cgroup_lock_live_group - take cgroup_mutex and check that cgrp is alive.
|
||||||
|
* @cgrp: the cgroup to be checked for liveness
|
||||||
|
*
|
||||||
|
* On success, returns true; the lock should be later released with
|
||||||
|
* cgroup_unlock(). On failure returns false with no lock held.
|
||||||
|
*/
|
||||||
|
bool cgroup_lock_live_group(struct cgroup *cgrp)
|
||||||
|
{
|
||||||
|
mutex_lock(&cgroup_mutex);
|
||||||
|
if (cgroup_is_removed(cgrp)) {
|
||||||
|
mutex_unlock(&cgroup_mutex);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cgroup_lock_live_group);
|
||||||
|
|
||||||
/* the list of cgroups eligible for automatic release. Protected by
|
/* the list of cgroups eligible for automatic release. Protected by
|
||||||
* release_list_lock */
|
* release_list_lock */
|
||||||
static LIST_HEAD(release_list);
|
static LIST_HEAD(release_list);
|
||||||
@ -1943,30 +1961,6 @@ static void cgroup_task_migrate(struct cgroup *oldcgrp,
|
|||||||
put_css_set(oldcg);
|
put_css_set(oldcg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* cgroup_attach_task_all - attach task 'tsk' to all cgroups of task 'from'
|
|
||||||
* @from: attach to all cgroups of a given task
|
|
||||||
* @tsk: the task to be attached
|
|
||||||
*/
|
|
||||||
int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk)
|
|
||||||
{
|
|
||||||
struct cgroupfs_root *root;
|
|
||||||
int retval = 0;
|
|
||||||
|
|
||||||
cgroup_lock();
|
|
||||||
for_each_active_root(root) {
|
|
||||||
struct cgroup *from_cg = task_cgroup_from_root(from, root);
|
|
||||||
|
|
||||||
retval = cgroup_attach_task(from_cg, tsk, false);
|
|
||||||
if (retval)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
cgroup_unlock();
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(cgroup_attach_task_all);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cgroup_attach_task - attach a task or a whole threadgroup to a cgroup
|
* cgroup_attach_task - attach a task or a whole threadgroup to a cgroup
|
||||||
* @cgrp: the cgroup to attach to
|
* @cgrp: the cgroup to attach to
|
||||||
@ -2204,6 +2198,30 @@ out_unlock_cgroup:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cgroup_attach_task_all - attach task 'tsk' to all cgroups of task 'from'
|
||||||
|
* @from: attach to all cgroups of a given task
|
||||||
|
* @tsk: the task to be attached
|
||||||
|
*/
|
||||||
|
int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk)
|
||||||
|
{
|
||||||
|
struct cgroupfs_root *root;
|
||||||
|
int retval = 0;
|
||||||
|
|
||||||
|
cgroup_lock();
|
||||||
|
for_each_active_root(root) {
|
||||||
|
struct cgroup *from_cg = task_cgroup_from_root(from, root);
|
||||||
|
|
||||||
|
retval = cgroup_attach_task(from_cg, tsk, false);
|
||||||
|
if (retval)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cgroup_unlock();
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(cgroup_attach_task_all);
|
||||||
|
|
||||||
static int cgroup_tasks_write(struct cgroup *cgrp, struct cftype *cft, u64 pid)
|
static int cgroup_tasks_write(struct cgroup *cgrp, struct cftype *cft, u64 pid)
|
||||||
{
|
{
|
||||||
return attach_task_by_pid(cgrp, pid, false);
|
return attach_task_by_pid(cgrp, pid, false);
|
||||||
@ -2214,24 +2232,6 @@ static int cgroup_procs_write(struct cgroup *cgrp, struct cftype *cft, u64 tgid)
|
|||||||
return attach_task_by_pid(cgrp, tgid, true);
|
return attach_task_by_pid(cgrp, tgid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* cgroup_lock_live_group - take cgroup_mutex and check that cgrp is alive.
|
|
||||||
* @cgrp: the cgroup to be checked for liveness
|
|
||||||
*
|
|
||||||
* On success, returns true; the lock should be later released with
|
|
||||||
* cgroup_unlock(). On failure returns false with no lock held.
|
|
||||||
*/
|
|
||||||
bool cgroup_lock_live_group(struct cgroup *cgrp)
|
|
||||||
{
|
|
||||||
mutex_lock(&cgroup_mutex);
|
|
||||||
if (cgroup_is_removed(cgrp)) {
|
|
||||||
mutex_unlock(&cgroup_mutex);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(cgroup_lock_live_group);
|
|
||||||
|
|
||||||
static int cgroup_release_agent_write(struct cgroup *cgrp, struct cftype *cft,
|
static int cgroup_release_agent_write(struct cgroup *cgrp, struct cftype *cft,
|
||||||
const char *buffer)
|
const char *buffer)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user