2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-15 08:44:14 +08:00

cgroup: reorder cgroup_migrate()'s parameters

cgroup_migrate() has the destination cgroup as the first parameter
while cgroup_task_migrate() has the destination cset as the last.
Another migration function is scheduled to be added which can make the
discrepancy further stand out.  Let's reorder cgroup_migrate()'s
parameters so that the destination cgroup is the last.

This doesn't cause any functional difference.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Zefan Li <lizefan@huawei.com>
This commit is contained in:
Tejun Heo 2015-09-11 15:00:20 -04:00
parent 4530eddb59
commit 9af2ec45c2

View File

@ -2362,9 +2362,9 @@ err:
/** /**
* cgroup_migrate - migrate a process or task to a cgroup * cgroup_migrate - migrate a process or task to a cgroup
* @cgrp: the destination cgroup
* @leader: the leader of the process or the task to migrate * @leader: the leader of the process or the task to migrate
* @threadgroup: whether @leader points to the whole process or a single task * @threadgroup: whether @leader points to the whole process or a single task
* @cgrp: the destination cgroup
* *
* Migrate a process or task denoted by @leader to @cgrp. If migrating a * Migrate a process or task denoted by @leader to @cgrp. If migrating a
* process, the caller must be holding cgroup_threadgroup_rwsem. The * process, the caller must be holding cgroup_threadgroup_rwsem. The
@ -2378,8 +2378,8 @@ err:
* decided for all targets by invoking group_migrate_prepare_dst() before * decided for all targets by invoking group_migrate_prepare_dst() before
* actually starting migrating. * actually starting migrating.
*/ */
static int cgroup_migrate(struct cgroup *cgrp, struct task_struct *leader, static int cgroup_migrate(struct task_struct *leader, bool threadgroup,
bool threadgroup) struct cgroup *cgrp)
{ {
struct cgroup_taskset tset = { struct cgroup_taskset tset = {
.src_csets = LIST_HEAD_INIT(tset.src_csets), .src_csets = LIST_HEAD_INIT(tset.src_csets),
@ -2516,7 +2516,7 @@ static int cgroup_attach_task(struct cgroup *dst_cgrp,
/* prepare dst csets and commit */ /* prepare dst csets and commit */
ret = cgroup_migrate_prepare_dst(dst_cgrp, &preloaded_csets); ret = cgroup_migrate_prepare_dst(dst_cgrp, &preloaded_csets);
if (!ret) if (!ret)
ret = cgroup_migrate(dst_cgrp, leader, threadgroup); ret = cgroup_migrate(leader, threadgroup, dst_cgrp);
cgroup_migrate_finish(&preloaded_csets); cgroup_migrate_finish(&preloaded_csets);
return ret; return ret;
@ -2823,7 +2823,7 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
goto out_finish; goto out_finish;
last_task = task; last_task = task;
ret = cgroup_migrate(src_cset->dfl_cgrp, task, true); ret = cgroup_migrate(task, true, src_cset->dfl_cgrp);
put_task_struct(task); put_task_struct(task);
@ -3905,7 +3905,7 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from)
css_task_iter_end(&it); css_task_iter_end(&it);
if (task) { if (task) {
ret = cgroup_migrate(to, task, false); ret = cgroup_migrate(task, false, to);
put_task_struct(task); put_task_struct(task);
} }
} while (task && !ret); } while (task && !ret);