linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] memcg/cgroup: do not fail fail on pre_destroy callbacks
@ 2012-10-17 13:30 Michal Hocko
  2012-10-17 13:30 ` [PATCH 1/6] memcg: split mem_cgroup_force_empty into reclaiming and reparenting parts Michal Hocko
                   ` (7 more replies)
  0 siblings, 8 replies; 32+ messages in thread
From: Michal Hocko @ 2012-10-17 13:30 UTC (permalink / raw)
  To: linux-mm
  Cc: cgroups, linux-kernel, Tejun Heo, Li Zefan, Johannes Weiner,
	KAMEZAWA Hiroyuki, Balbir Singh

Hi,
memcg is the only controller which might fail in its pre_destroy
callback which makes the cgroup core more complicated for no good
reason. This is an attempt to change this unfortunate state. 

I am sending this a RFC because I would like to hear back whether the
approach is correct. I thought that the changes would be more invasive
but it seems that the current code was mostly prepared for this and it
needs just some small tweaks (so I might be missing something important
here).

The first two patches are just clean ups. They could be merged even
without the rest.

The real change, although the code is not changed that much, is the 3rd
patch. It changes the way how we handle mem_cgroup_move_parent failures.
We have to realize that all those failures are *temporal*. Because we
are either racing with the page removal or the page is temporarily off
the LRU because of migration resp. global reclaim. As a result we do
not fail mem_cgroup_force_empty_list if the page cannot be moved to the
parent and rather retry until the LRU is empty.

The 4th patch is for cgroup core. I have moved cgroup_call_pre_destroy
inside the cgroup_lock which is not very nice because the callbacks
can take some time. Maybe we can move this call at the very end of the
function?
All I need for memcg is that cgroup_call_pre_destroy has been called and
that no new cgroups can be attached to the group. The cgroup_lock is
necessary for the later condition but if we move after CGRP_REMOVED flag
is set then we are safe as well.

The last two patches are trivial follow ups for the cgroups core change
because now we know that nobody will interfere with us so we can drop
those empty && no child condition.

Comments, thoughts?

Michal Hocko (6):
      memcg: split mem_cgroup_force_empty into reclaiming and reparenting parts
      memcg: root_cgroup cannot reach mem_cgroup_move_parent
      memcg: Simplify mem_cgroup_force_empty_list error handling
      cgroups: forbid pre_destroy callback to fail
      memcg: make mem_cgroup_reparent_charges non failing
      hugetlb: do not fail in hugetlb_cgroup_pre_destroy

Cumulative diffstat:
 kernel/cgroup.c     |   30 ++++---------
 mm/hugetlb_cgroup.c |   11 ++---
 mm/memcontrol.c     |  124 +++++++++++++++++++++++++++------------------------
 3 files changed, 78 insertions(+), 87 deletions(-)

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

end of thread, other threads:[~2012-10-25 18:48 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-17 13:30 [RFC] memcg/cgroup: do not fail fail on pre_destroy callbacks Michal Hocko
2012-10-17 13:30 ` [PATCH 1/6] memcg: split mem_cgroup_force_empty into reclaiming and reparenting parts Michal Hocko
2012-10-18 21:56   ` Tejun Heo
2012-10-17 13:30 ` [PATCH 2/6] memcg: root_cgroup cannot reach mem_cgroup_move_parent Michal Hocko
2012-10-18 21:58   ` Tejun Heo
2012-10-17 13:30 ` [PATCH 3/6] memcg: Simplify mem_cgroup_force_empty_list error handling Michal Hocko
2012-10-18 22:16   ` Tejun Heo
2012-10-19 13:24     ` Michal Hocko
2012-10-19 19:49       ` Tejun Heo
2012-10-17 13:30 ` [PATCH 4/6] cgroups: forbid pre_destroy callback to fail Michal Hocko
2012-10-18 22:41   ` Tejun Heo
2012-10-18 22:46     ` Tejun Heo
2012-10-19 13:34       ` Michal Hocko
2012-10-19 13:32     ` Michal Hocko
2012-10-19 20:24       ` Tejun Heo
2012-10-22 10:30         ` Michal Hocko
2012-10-24 19:25           ` Tejun Heo
2012-10-25 14:37             ` Michal Hocko
2012-10-25 17:42               ` Tejun Heo
2012-10-25 18:48                 ` Michal Hocko
2012-10-19  9:33   ` Li Zefan
2012-10-19 11:09     ` Michal Hocko
2012-10-19 20:17     ` Tejun Heo
2012-10-17 13:30 ` [PATCH 5/6] memcg: make mem_cgroup_reparent_charges non failing Michal Hocko
2012-10-18  8:30   ` Li Zefan
2012-10-18  8:42     ` Michal Hocko
2012-10-18 22:48   ` Tejun Heo
2012-10-19 13:49   ` Michal Hocko
2012-10-17 13:30 ` [PATCH 6/6] hugetlb: do not fail in hugetlb_cgroup_pre_destroy Michal Hocko
2012-10-18 22:48   ` Tejun Heo
2012-10-17 15:30 ` [RFC] memcg/cgroup: do not fail fail on pre_destroy callbacks Glauber Costa
2012-10-18  0:29 ` Kamezawa Hiroyuki

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).