cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET cgroup/for-4.2] cgroup: make multi-process migration atomic
@ 2015-05-18 19:49 Tejun Heo
       [not found] ` <1431978595-12176-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2015-05-19  6:57 ` [PATCHSET cgroup/for-4.2] cgroup: make multi-process migration atomic Zefan Li
  0 siblings, 2 replies; 34+ messages in thread
From: Tejun Heo @ 2015-05-18 19:49 UTC (permalink / raw)
  To: lizefan-hv44wF8Li93QT0dZR+AlfA
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, hannes-druUgvl0LCNAfugRpC6u6w,
	mhocko-AlSwsSmVLrQ, linux-mm-Bw31MaZKKs3YtjvyW6yDsg

Hello,

When a controller is enabled or disabled on the unified hierarchy, the
effective css changes for all processes in the sub-hierarchy which
virtually is multi-process migration.  This is implemented in
cgroup_update_dfl_csses() as process-by-process migration - all the
target source css_sets are first chained to the target list and
processes are drained from them one-by-one.

If a process gets rejected by a controller after some are successfully
migrated, the recovery action is tricky.  The changes which have
happened upto this point have to be rolled back but there's nothing
guaranteeing such rollback would be successful either.

The unified hierarchy didn't need to deal with this issue because
organizational operations were expected to always succeed;
unfortunately, it turned out that such policy doesn't work too well
for certain type of resources and unified hierarchy would need to
allow migration failures for some restrictied cases.

This patch updates multi-process migration in
cgroup_update_dfl_csses() atomic so that ->can_attach() can fail the
whole transaction.  It's consisted of the following seven patches.

 0001-cpuset-migrate-memory-only-for-threadgroup-leaders.patch
 0002-memcg-restructure-mem_cgroup_can_attach.patch
 0003-memcg-immigrate-charges-only-when-a-threadgroup-lead.patch
 0004-cgroup-memcg-cpuset-implement-cgroup_taskset_for_eac.patch
 0005-reorder-cgroup_migrate-s-parameters.patch
 0006-cgroup-separate-out-taskset-operations-from-cgroup_m.patch
 0007-cgroup-make-cgroup_update_dfl_csses-migrate-all-targ.patch

0001-0004 prepare cpuset and memcg.  Note that 0001 and 0003 do cause
behavioral changes in that mm is now always tied to the threadgroup
leader.  Avoiding this change isn't too difficult but both the code
and behavior are saner this way and I don't think the change is likely
to cause breakage.

0005-0007 prepare and implement atomic multi-process migration.

This patchset is on top of the following patches.

 cgroup/for-4.2 d0f702e648dc ("cgroup: fix some comment typos")
 + [1] [PATCH] cgroup: separate out include/linux/cgroup-defs.h
 + [2] [PATCH] cgroup: reorganize include/linux/cgroup.h
 + [3] [PATCHSET] cgroup, sched: restructure threadgroup locking and replace it with a percpu_rwsem

and available in the following git branch.

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-multi-process-migration

diffstat follows.  Thanks.

 include/linux/cgroup.h |   22 +++
 kernel/cgroup.c        |  278 ++++++++++++++++++++++++-------------------------
 kernel/cpuset.c        |   41 +++----
 mm/memcontrol.c        |   74 +++++++------
 4 files changed, 228 insertions(+), 187 deletions(-)

--
tejun

[1] http://lkml.kernel.org/g/20150513193840.GC11388-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org
[2] http://lkml.kernel.org/g/20150513202416.GE11388-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org
[3] http://lkml.kernel.org/g/1431549318-16756-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2015-05-26  7:16 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-18 19:49 [PATCHSET cgroup/for-4.2] cgroup: make multi-process migration atomic Tejun Heo
     [not found] ` <1431978595-12176-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-05-18 19:49   ` [PATCH 1/7] cpuset: migrate memory only for threadgroup leaders Tejun Heo
2015-05-18 19:49   ` [PATCH 2/7] memcg: restructure mem_cgroup_can_attach() Tejun Heo
     [not found]     ` <1431978595-12176-3-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-05-19  9:03       ` Michal Hocko
2015-05-18 19:49   ` [PATCH 3/7] memcg: immigrate charges only when a threadgroup leader is moved Tejun Heo
     [not found]     ` <1431978595-12176-4-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-05-19 12:13       ` Michal Hocko
     [not found]         ` <20150519121321.GB6203-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-05-19 13:10           ` Michal Hocko
2015-05-19 21:27           ` Tejun Heo
2015-05-20 13:10             ` Michal Hocko
2015-05-20 13:21               ` Michal Hocko
     [not found]                 ` <20150520132158.GB28678-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-05-20 17:53                   ` Oleg Nesterov
2015-05-20 20:22                     ` Michal Hocko
     [not found]                       ` <20150520202221.GD14256-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-05-21 17:22                         ` Johannes Weiner
2015-05-22  9:34                           ` Michal Hocko
2015-05-21 19:27                         ` Oleg Nesterov
     [not found]                           ` <20150521192716.GA21304-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-22  9:36                             ` Michal Hocko
     [not found]                               ` <20150522093639.GE5109-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-05-22 16:29                                 ` Oleg Nesterov
2015-05-22 16:57                                   ` Michal Hocko
2015-05-22 18:30                                     ` Oleg Nesterov
     [not found]                                       ` <20150522183042.GF26770-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-25 16:06                                         ` Michal Hocko
     [not found]                                           ` <20150525160626.GC19389-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-05-25 17:06                                             ` Oleg Nesterov
     [not found]                                               ` <20150525170601.GA438-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-26  7:16                                                 ` Michal Hocko
2015-05-22 18:20                                   ` [PATCH 0/3] memcg: mm_update_next_owner() cleanups Oleg Nesterov
     [not found]                                     ` <20150522182054.GA26770-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-22 18:21                                       ` [PATCH 1/3] memcg: introduce assign_new_owner() Oleg Nesterov
2015-05-22 18:21                                       ` [PATCH 2/3] memcg: change assign_new_owner() to consider the sub-htreads Oleg Nesterov
2015-05-22 18:21                                     ` [PATCH 3/3] memcg: change mm_update_next_owner() to search in sub-threads first Oleg Nesterov
2015-05-22 18:22                                     ` [PATCH 0/3] memcg: mm_update_next_owner() cleanups Oleg Nesterov
2015-05-21 14:12       ` [PATCH 3/7] memcg: immigrate charges only when a threadgroup leader is moved Michal Hocko
     [not found]         ` <20150521141225.GB14475-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2015-05-21 22:09           ` Tejun Heo
2015-05-18 19:49   ` [PATCH 4/7] cgroup, memcg, cpuset: implement cgroup_taskset_for_each_leader() Tejun Heo
2015-05-18 19:49   ` [PATCH 5/7] reorder cgroup_migrate()'s parameters Tejun Heo
2015-05-18 19:49   ` [PATCH 6/7] cgroup: separate out taskset operations from cgroup_migrate() Tejun Heo
2015-05-18 19:49   ` [PATCH 7/7] cgroup: make cgroup_update_dfl_csses() migrate all target processes atomically Tejun Heo
2015-05-19  6:57 ` [PATCHSET cgroup/for-4.2] cgroup: make multi-process migration atomic Zefan Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).