]> git.baikalelectronics.ru Git - kernel.git/commit
cgroup: combine cgroup_mutex locking and offline css draining
authorTejun Heo <tj@kernel.org>
Thu, 3 Mar 2016 14:58:00 +0000 (09:58 -0500)
committerTejun Heo <tj@kernel.org>
Thu, 3 Mar 2016 14:58:00 +0000 (09:58 -0500)
commit7d130705e89bf48796c326f74ef79ef54184dc37
tree4bf5e7a11fbb4c80148c53c77be5105f131cf5a0
parent3de090343d6aad92c3c5ee92f78dad79bb248a8f
cgroup: combine cgroup_mutex locking and offline css draining

cgroup_drain_offline() is used to wait for csses being offlined to
uninstall itself from cgroup->subsys[] array so that new csses can be
installed.  The function's only user, cgroup_subtree_control_write(),
calls it after performing some checks and restarts the whole process
via restart_syscall() if draining has to release cgroup_mutex to wait.

This can be simplified by draining before other synchronized
operations so that there's nothing to restart.  This patch converts
cgroup_drain_offline() to cgroup_lock_and_drain_offline() which
performs both locking and draining and updates cgroup_kn_lock_live()
use it instead of cgroup_mutex() if requested.  This combined locking
and draining operations are easier to use and less error-prone.

While at it, add WARNs in control_apply functions which triggers if
the subtree isn't properly drained.

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