diff options
author | Tejun Heo <tj@kernel.org> | 2011-12-13 03:12:21 +0100 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-12-13 03:12:21 +0100 |
commit | cd3d095275374220921fcf0d4e0c16584b26ddbc (patch) | |
tree | eb867534c5cdfa111f88b255f76242e93fddb8b6 /usr | |
parent | threadgroup: extend threadgroup_lock() to cover exit and exec (diff) | |
download | linux-cd3d095275374220921fcf0d4e0c16584b26ddbc.tar.xz linux-cd3d095275374220921fcf0d4e0c16584b26ddbc.zip |
cgroup: always lock threadgroup during migration
Update cgroup to take advantage of the fack that threadgroup_lock()
guarantees stable threadgroup.
* Lock threadgroup even if the target is a single task. This
guarantees that when the target tasks stay stable during migration
regardless of the target type.
* Remove PF_EXITING early exit optimization from attach_task_by_pid()
and check it in cgroup_task_migrate() instead. The optimization was
for rather cold path to begin with and PF_EXITING state can be
trusted throughout migration by checking it after locking
threadgroup.
* Don't add PF_EXITING tasks to target task array in
cgroup_attach_proc(). This ensures that task migration is performed
only for live tasks.
* Remove -ESRCH failure path from cgroup_task_migrate(). With the
above changes, it's guaranteed to be called only for live tasks.
After the changes, only live tasks are migrated and they're guaranteed
to stay alive until migration is complete. This removes problems
caused by exec and exit racing against cgroup migration including
symmetry among cgroup attach methods and different cgroup methods
racing each other.
v2: Oleg pointed out that one more PF_EXITING check can be removed
from cgroup_attach_proc(). Removed.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Menage <paul@paulmenage.org>
Diffstat (limited to 'usr')
0 files changed, 0 insertions, 0 deletions