]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit - kernel/cpuset.c
cpuset: make CPU / memory hotplug propagation asynchronous
authorTejun Heo <tj@kernel.org>
Mon, 7 Jan 2013 16:51:07 +0000 (08:51 -0800)
committerTejun Heo <tj@kernel.org>
Mon, 7 Jan 2013 16:51:07 +0000 (08:51 -0800)
commit8d03394877ecdf87e1d694664c460747b8e05aa1
treed7f2301996b9e0a747ada2385244c670e7da7bb2
parent699140ba838dd3fa2c5cce474e14f194b09f91aa
cpuset: make CPU / memory hotplug propagation asynchronous

cpuset_hotplug_workfn() has been invoking cpuset_propagate_hotplug()
directly to propagate hotplug updates to !root cpusets; however, this
has the following problems.

* cpuset locking is scheduled to be decoupled from cgroup_mutex,
  cgroup_mutex will be unexported, and cgroup_attach_task() will do
  cgroup locking internally, so propagation can't synchronously move
  tasks to a parent cgroup while walking the hierarchy.

* We can't use cgroup generic tree iterator because propagation to
  each cpuset may sleep.  With propagation done asynchronously, we can
  lose the rather ugly cpuset specific iteration.

Convert cpuset_propagate_hotplug() to
cpuset_propagate_hotplug_workfn() and execute it from newly added
cpuset->hotplug_work.  The work items are run on an ordered workqueue,
so the propagation order is preserved.  cpuset_hotplug_workfn()
schedules all propagations while holding cgroup_mutex and waits for
completion without cgroup_mutex.  Each in-flight propagation holds a
reference to the cpuset->css.

This patch doesn't cause any functional difference.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
kernel/cpuset.c